-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnext_release.py
56 lines (42 loc) · 1.21 KB
/
next_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
import re
import os
from bussilab import __version__
def confirm():
cont=True
while cont:
response=input("Confirm (yes/no)?")
if re.match("[Yy][Ee][Ss]",response):
cont=False
elif re.match("[Nn][Oo]",response):
quit()
else:
pass
print("Changing to master branch")
os.system("git checkout master")
print("Current version:",__version__)
new_version=re.sub("[0-9]*$","",__version__) + str(int(re.sub("^.*\.","",__version__))+1)
response=input("New version (default " + new_version + "):")
if len(response)>0:
new_version=response
print("New version "+new_version)
confirm()
lines=[]
with open("bussilab/_version.py") as f:
for line in f:
line=re.sub("^ *__version__ *=.*$",'__version__ = "' + new_version + '"',line)
lines.append(line)
with open("bussilab/_version.py","w") as f:
for line in lines:
print(line,file=f,end='')
cmd=[
'git add bussilab/_version.py',
'git commit -m "Version ' + new_version + '"',
'git tag v' + new_version,
'git push origin master v' + new_version
]
print("Will now execute the following commands:")
for c in cmd:
print(" " + c)
confirm()
for c in cmd:
os.system(c)