-
Notifications
You must be signed in to change notification settings - Fork 11
/
release.py
executable file
·64 lines (46 loc) · 1.61 KB
/
release.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python
# Helper script to create and publish a new fishnet release.
from __future__ import print_function
import os
import sys
import fairyfishnet
try:
input = raw_input
except NameError:
pass
def system(command):
print(command)
exit_code = os.system(command)
if exit_code != 0:
sys.exit(exit_code)
def check_git():
print("--- CHECK GIT --------------------------------------------------------")
system("git diff --exit-code")
system("git diff --cached --exit-code")
def test():
print("--- TEST -------------------------------------------------------------")
system("python3 test.py")
def check_docs():
print("--- CHECK DOCS -------------------------------------------------------")
system("python3 setup.py --long-description | rst2html --strict --no-raw > /dev/null")
def tag_and_push():
print("--- TAG AND PUSH -------------------------------")
tagname = "v{0}".format(fairyfishnet.__version__)
guessed_tagname = input(">>> Sure? Confirm tagname: ")
if guessed_tagname != tagname:
print("Actual tag name is: {0}".format(tagname))
sys.exit(1)
system("git tag {0}".format(tagname))
system("git push --atomic origin master {0}".format(tagname))
def pypi():
print("--- PYPI -------------------------------------------------------------")
system("rm -rf build")
system("python3 setup.py sdist bdist_wheel --universal")
system("twine check dist/*")
system("twine upload --skip-existing --sign dist/*")
if __name__ == "__main__":
test()
# check_docs()
check_git()
tag_and_push()
pypi()