-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.py
executable file
·47 lines (36 loc) · 958 Bytes
/
build.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from meta import githubUrl
from textwrap import dedent
from glob import glob
import is_git_repo_clean
import os
import subprocess
import sys
def printErr(msg):
print(msg, file=sys.stderr)
if not is_git_repo_clean.checkSync():
printErr(
dedent(
"""
the git repo is not clean
aborting build\
"""
)
)
exit(1)
pypiWarning = dedent(
f"""\
*Note: This document is best viewed [on github]({githubUrl}).
Pypi's headers are all caps which presents inaccurate information*"
"""
)
pypiWarnComment = "<!-- pypiwarn -->"
with open("./README.md", "r") as f:
commentedWarn = f.read()
with open("./README.md", "w") as f:
f.write(commentedWarn.replace(pypiWarnComment, pypiWarning, 1))
for f in glob("dist/*"):
os.remove(f)
subprocess.run([sys.executable, "setup.py", "sdist"])
with open("README.md", "w") as f:
f.write(commentedWarn)
print("donezo!")