... | ... |
@@ -1,13 +1,11 @@ |
1 | 1 |
from pathlib import Path |
2 | 2 |
from shutil import copyfile |
3 | 3 |
|
4 |
-Path('my_package').mkdir(exist_ok=True) |
|
5 |
-copyfile('../miniver/miniver/_static_version.py', |
|
6 |
- 'my_package/_static_version.py') |
|
7 |
-copyfile('../miniver/miniver/_version.py', |
|
8 |
- 'my_package/_version.py') |
|
4 |
+Path("my_package").mkdir(exist_ok=True) |
|
5 |
+copyfile("../miniver/miniver/_static_version.py", "my_package/_static_version.py") |
|
6 |
+copyfile("../miniver/miniver/_version.py", "my_package/_version.py") |
|
9 | 7 |
|
10 |
-README_filename = '../miniver/README.md' |
|
8 |
+README_filename = "../miniver/README.md" |
|
11 | 9 |
|
12 | 10 |
|
13 | 11 |
def write_snippet_from_readme(outfile, start_marker, file_header=None): |
... | ... |
@@ -17,22 +15,21 @@ def write_snippet_from_readme(outfile, start_marker, file_header=None): |
17 | 15 |
if line.startswith(start_marker): |
18 | 16 |
break |
19 | 17 |
else: |
20 |
- raise RuntimeError('Could not find start_marker: {}' |
|
21 |
- ''.format(start_marker)) |
|
22 |
- with open(outfile, 'w') as out: |
|
18 |
+ raise RuntimeError( |
|
19 |
+ "Could not find start_marker: {}" "".format(start_marker) |
|
20 |
+ ) |
|
21 |
+ with open(outfile, "w") as out: |
|
23 | 22 |
out.write(line) |
24 | 23 |
if file_header is not None: |
25 | 24 |
out.write(file_header) |
26 | 25 |
for line in f: |
27 |
- if line.startswith('```'): |
|
26 |
+ if line.startswith("```"): |
|
28 | 27 |
break |
29 | 28 |
out.write(line) |
30 | 29 |
|
31 | 30 |
|
32 |
-write_snippet_from_readme("setup.py", |
|
33 |
- "# Your project's setup.py", |
|
34 |
- "from setuptools import setup\n") |
|
35 |
-write_snippet_from_readme(".gitattributes", |
|
36 |
- "# Your project's .gitattributes") |
|
37 |
-write_snippet_from_readme("my_package/__init__.py", |
|
38 |
- "# Your package's __init__.py") |
|
31 |
+write_snippet_from_readme( |
|
32 |
+ "setup.py", "# Your project's setup.py", "from setuptools import setup\n" |
|
33 |
+) |
|
34 |
+write_snippet_from_readme(".gitattributes", "# Your project's .gitattributes") |
|
35 |
+write_snippet_from_readme("my_package/__init__.py", "# Your package's __init__.py") |
... | ... |
@@ -9,6 +9,7 @@ copyfile('../miniver/miniver/_version.py', |
9 | 9 |
|
10 | 10 |
README_filename = '../miniver/README.md' |
11 | 11 |
|
12 |
+ |
|
12 | 13 |
def write_snippet_from_readme(outfile, start_marker, file_header=None): |
13 | 14 |
# Create the setup file |
14 | 15 |
with open(README_filename) as f: |
... | ... |
@@ -27,6 +28,7 @@ def write_snippet_from_readme(outfile, start_marker, file_header=None): |
27 | 28 |
break |
28 | 29 |
out.write(line) |
29 | 30 |
|
31 |
+ |
|
30 | 32 |
write_snippet_from_readme("setup.py", |
31 | 33 |
"# Your project's setup.py", |
32 | 34 |
"from setuptools import setup\n") |
1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,36 @@ |
1 |
+from pathlib import Path |
|
2 |
+from shutil import copyfile |
|
3 |
+ |
|
4 |
+Path('my_package').mkdir(exist_ok=True) |
|
5 |
+copyfile('../miniver/miniver/_static_version.py', |
|
6 |
+ 'my_package/_static_version.py') |
|
7 |
+copyfile('../miniver/miniver/_version.py', |
|
8 |
+ 'my_package/_version.py') |
|
9 |
+ |
|
10 |
+README_filename = '../miniver/README.md' |
|
11 |
+ |
|
12 |
+def write_snippet_from_readme(outfile, start_marker, file_header=None): |
|
13 |
+ # Create the setup file |
|
14 |
+ with open(README_filename) as f: |
|
15 |
+ for line in f: |
|
16 |
+ if line.startswith(start_marker): |
|
17 |
+ break |
|
18 |
+ else: |
|
19 |
+ raise RuntimeError('Could not find start_marker: {}' |
|
20 |
+ ''.format(start_marker)) |
|
21 |
+ with open(outfile, 'w') as out: |
|
22 |
+ out.write(line) |
|
23 |
+ if file_header is not None: |
|
24 |
+ out.write(file_header) |
|
25 |
+ for line in f: |
|
26 |
+ if line.startswith('```'): |
|
27 |
+ break |
|
28 |
+ out.write(line) |
|
29 |
+ |
|
30 |
+write_snippet_from_readme("setup.py", |
|
31 |
+ "# Your project's setup.py", |
|
32 |
+ "from setuptools import setup\n") |
|
33 |
+write_snippet_from_readme(".gitattributes", |
|
34 |
+ "# Your project's .gitattributes") |
|
35 |
+write_snippet_from_readme("my_package/__init__.py", |
|
36 |
+ "# Your package's __init__.py") |