Conditions | 4 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | import re |
||
5 | def bump_version(): |
||
6 | with open("setup.py") as f: |
||
7 | s = f.read() |
||
8 | m = re.search(r'version="(.*)\.(.*)\.(.*)",', s) |
||
9 | v1, v2, v3 = m.groups() |
||
10 | oldv = "{}.{}.{}".format(v1, v2, v3) |
||
11 | newv = "{}.{}.{}".format(v1, v2, str(int(v3) + 1)) |
||
12 | print("Current version is: {}, write new version, ctrl-c to exit".format(oldv)) |
||
13 | ans = input(newv) |
||
14 | if ans: |
||
15 | newv = ans |
||
16 | s = s.replace(oldv, newv) |
||
17 | with open("setup.py", "w") as f: |
||
18 | f.write(s) |
||
19 | return newv |
||
20 | |||
40 |