7ddc0051 |
from pathlib import Path
from shutil import copyfile
|
9cce6560 |
Path("my_package").mkdir(exist_ok=True)
copyfile("../miniver/miniver/_static_version.py", "my_package/_static_version.py")
copyfile("../miniver/miniver/_version.py", "my_package/_version.py")
|
7ddc0051 |
|
9cce6560 |
README_filename = "../miniver/README.md"
|
7ddc0051 |
|
0a22aef7 |
|
7ddc0051 |
def write_snippet_from_readme(outfile, start_marker, file_header=None):
# Create the setup file
with open(README_filename) as f:
for line in f:
if line.startswith(start_marker):
break
else:
|
9cce6560 |
raise RuntimeError(
"Could not find start_marker: {}" "".format(start_marker)
)
with open(outfile, "w") as out:
|
7ddc0051 |
out.write(line)
if file_header is not None:
out.write(file_header)
for line in f:
|
9cce6560 |
if line.startswith("```"):
|
7ddc0051 |
break
out.write(line)
|
0a22aef7 |
|
9cce6560 |
write_snippet_from_readme(
"setup.py", "# Your project's setup.py", "from setuptools import setup\n"
)
write_snippet_from_readme(".gitattributes", "# Your project's .gitattributes")
write_snippet_from_readme("my_package/__init__.py", "# Your package's __init__.py")
|