forked from sstcam/SSDAQ
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.py
More file actions
50 lines (43 loc) · 1.52 KB
/
Copy pathrelease.py
File metadata and controls
50 lines (43 loc) · 1.52 KB
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
import re
import os
def bump_version():
with open("ssdaq/version.py") as f:
s = f.read()
m = re.search(r'__version__ = "(.*)\.(.*)\.(.*)"', s)
v1, v2, v3 = m.groups()
oldv = "{0}.{1}.{2}".format(v1, v2, v3)
newv = "{0}.{1}.{2}".format(v1, v2, str(int(v3) + 1))
print("Current version is: {0}, write new version, ctrl-c to exit".format(oldv))
try:
ans = input(newv)
if ans:
newv = ans
ans = input("Change version to, %s?(Y/n)" % newv)
if ans not in ("", "y", "yes"):
print("Exiting...")
raise KeyboardInterrupt
# s = s.replace(oldv, newv)
# with open("ssdaq/version.py", "w") as f:
# f.write(s)
except KeyboardInterrupt:
print("\nInterrupted, version not changed...")
exit()
return newv
def release():
v = bump_version()
ans = input("version bumped, commiting?(Y/n)")
if ans in ("", "y", "yes"):
os.system("git add ssdaq/version.py")
os.system("git commit -m 'new release'")
os.system("git tag v{0}".format(v))
ans = input("change committed, push to server?(Y/n)")
if ans in ("", "y", "yes"):
os.system("git push")
os.system("git push --tags")
# ans = input("upload to pip?(Y/n)")
# if ans in ("", "y", "yes"):
# os.system("rm -rf dist/*")
# os.system("python setup.py sdist")
# os.system("twine upload dist/*")
if __name__ == "__main__":
release()