This repository has been archived by the owner on Jan 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
/
update_version.py
executable file
·56 lines (47 loc) · 1.79 KB
/
update_version.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
#!/usr/bin/env python
import fileinput
import sys
def update_cmakelist(new_version):
for line in fileinput.input(files=("CMakeLists.txt",), inplace=True):
if line.startswith("set(ATK_VERSION"):
sys.stdout.write("set(ATK_VERSION %s)\n" % new_version)
else:
sys.stdout.write(line)
def update_appveyor(new_version):
for line in fileinput.input(files=(".appveyor.yml",), inplace=True):
if line.startswith("version"):
sys.stdout.write("version: '%s.{build}'\n" % new_version)
else:
sys.stdout.write(line)
def update_doxygen(new_version):
for line in fileinput.input(files=("Doxyfile",), inplace=True):
if line.startswith("PROJECT_NUMBER"):
sys.stdout.write("PROJECT_NUMBER = %s\n" % new_version)
else:
sys.stdout.write(line)
def update_changelog(new_version):
for line in fileinput.input(files=("README.md",), inplace=True):
sys.stdout.write(line)
if line.startswith("## Changelog"):
sys.stdout.write("### %s\n\n" % new_version)
def update_sonarqube(new_version):
for line in fileinput.input(files=("sonar-project.properties",), inplace=True):
if line.startswith("sonar.projectVersion"):
sys.stdout.write("sonar.projectVersion=%s\n" % new_version)
else:
sys.stdout.write(line)
def update_juce_modules(new_version):
import glob
for header in glob.glob("modules/JUCE/atk_*/atk_*.h"):
for line in fileinput.input(files=(header,), inplace=True):
if line.startswith(" version:"):
sys.stdout.write(" version: %s\n" % new_version)
else:
sys.stdout.write(line)
if __name__ == "__main__":
update_cmakelist(sys.argv[1])
update_appveyor(sys.argv[1])
update_doxygen(sys.argv[1])
update_changelog(sys.argv[1])
update_sonarqube(sys.argv[1])
update_juce_modules(sys.argv[1])