source: ogAgent-Git/src/update.py @ 10fab78

configure-ptt-chedecorare-oglive-methodsejecutarscript-b64fix-cfg2objfixes-winlgromero-filebeatmainmodulesnew-browserno-ptt-paramogadmcliogadmclient-statusogagent-jobsogagent-macosogcore1oglogoglog2override-moduleping1ping2ping3ping4py3-winreport-progresstlsunification2unification3versionswindows-fixes
Last change on this file since 10fab78 was 10fab78, checked in by Natalia Serrano <natalia.serrano@…>, 10 months ago

refs #464 several fixes and improvements

  • fix OG icon in windows system tray
  • change a log.info into log.debug to avoid a crash (!)
  • migrate update.sh to python so it can be run from windows/macos too
    • manage windows/VERSION in this script too
    • remove call to pyrcc--it's not required!
  • remove stray windows scripts
  • add a forgotten setup.bat
  • Property mode set to 100755
File size: 1.2 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                print (line.replace ('Version [^<]*', f'Version {version}'), end='')
21
22        with fileinput.FileInput ('opengnsys/__init__.py', inplace=True) as file:
23            for line in file:
24                print(line.replace ('VERSION=.*', f"VERSION='{version}'"), end='')
25
26        with open ('../windows/VERSION', 'w') as outfile:
27            outfile.write (win_version + '\n')
28
29    else:
30        print ('VERSION: No such file or directory')
31        sys.exit (1)
32
33def process_ui():
34    subprocess.run (['pyuic6', 'about-dialog.ui',   '-o', 'about_dialog_ui.py',   '-x'])
35    subprocess.run (['pyuic6', 'message-dialog.ui', '-o', 'message_dialog_ui.py', '-x'])
36
37if __name__ == "__main__":
38    os.chdir (os.path.dirname (os.path.abspath (__file__)))
39    update_version()
40    process_ui()
Note: See TracBrowser for help on using the repository browser.