source: ogAgent-Git/src/update.py @ 9d65966

configure-ptt-chedecorare-oglive-methodsejecutarscript-b64fix-cfg2objfixes-winlgromero-filebeatmainnew-browserno-ptt-paramogadmclient-statusogcore1oglogoglog2override-moduleping1ping2ping3ping4report-progresstlsunification2unification3
Last change on this file since 9d65966 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
3import os
4import re
5import sys
6import subprocess
7import fileinput
8
9def 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
35def 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
39if __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.