maintls
4.0.0
Last change
on this file since c39b253 was
b7788d9,
checked in by Natalia Serrano <natalia.serrano@…>, 9 months ago
|
refs #538 fix updating the ogagent version across the codebase
|
-
Property mode set to
100755
|
File size:
1.3 KB
|
Line | |
---|
1 | #!/usr/bin/python3 |
---|
2 | |
---|
3 | import os |
---|
4 | import re |
---|
5 | import sys |
---|
6 | import subprocess |
---|
7 | import fileinput |
---|
8 | |
---|
9 | def update_version(): |
---|
10 | if os.path.isfile ('VERSION'): |
---|
11 | with open ('VERSION', 'r') as version_file: |
---|
12 | version = version_file.read().strip() |
---|
13 | |
---|
14 | pattern = r'[0-9]*\.[0-9]*\.[0-9]*' |
---|
15 | matches = re.findall (pattern, version) |
---|
16 | win_version = matches[0] |
---|
17 | |
---|
18 | with fileinput.FileInput ('about-dialog.ui', inplace=True) as file: |
---|
19 | for line in file: |
---|
20 | new = re.sub (r'Version [^<]*', 'Version {}'.format(version), line) |
---|
21 | print (new, end='') |
---|
22 | |
---|
23 | with fileinput.FileInput ('opengnsys/__init__.py', inplace=True) as file: |
---|
24 | for line in file: |
---|
25 | new = re.sub (r'VERSION=.*', "VERSION='{}'".format(version), line) |
---|
26 | print (new, end='') |
---|
27 | |
---|
28 | with open ('../windows/VERSION', 'w') as outfile: |
---|
29 | outfile.write (win_version + '\n') |
---|
30 | |
---|
31 | else: |
---|
32 | print ('VERSION: No such file or directory') |
---|
33 | sys.exit (1) |
---|
34 | |
---|
35 | def process_ui(): |
---|
36 | subprocess.run (['pyuic6', 'about-dialog.ui', '-o', 'about_dialog_ui.py', '-x']) |
---|
37 | subprocess.run (['pyuic6', 'message-dialog.ui', '-o', 'message_dialog_ui.py', '-x']) |
---|
38 | |
---|
39 | if __name__ == "__main__": |
---|
40 | os.chdir (os.path.dirname (os.path.abspath (__file__))) |
---|
41 | update_version() |
---|
42 | process_ui() |
---|
Note: See
TracBrowser
for help on using the repository browser.