Cleanup and update version.py wxPython4
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Sun, 21 Aug 2022 17:44:03 +0200
branchwxPython4
changeset 3587 295f21f9c581
parent 3586 cbc6a6ccd52e
child 3588 412090a6b3a7
Cleanup and update version.py
version.py
--- a/version.py	Wed Aug 17 15:55:56 2022 +0200
+++ b/version.py	Sun Aug 21 17:44:03 2022 +0200
@@ -25,13 +25,10 @@
 
 from __future__ import absolute_import
 from __future__ import unicode_literals
+from __future__ import print_function
 
-import subprocess
 import os
 
-import util.paths as paths
-
-
 def GetCommunityHelpMsg():
     return _(
         "The best place to ask questions about Beremiz/PLCOpenEditor\n"
@@ -45,32 +42,6 @@
     )
 
 
-def GetAppRevision():
-    rev = None
-    app_dir = paths.AbsDir(__file__)
-    try:
-        pipe = subprocess.Popen(
-            ["hg", "id", "-i"],
-            stdout=subprocess.PIPE,
-            cwd=app_dir
-        )
-        rev = pipe.communicate()[0]
-        if pipe.returncode != 0:
-            rev = None
-    except Exception:
-        pass
-
-    # if this is not mercurial repository
-    # try to read revision from file
-    if rev is None:
-        try:
-            f = open(os.path.join(app_dir, "revision"))
-            rev = f.readline()
-        except Exception:
-            pass
-    return rev
-
-
 def GetAboutDialogInfo(info):
 
     info.Version = app_version
@@ -107,8 +78,8 @@
     )
 
     # read license file
-    path = paths.AbsDir(__file__)
-    license_path = os.path.join(path, "COPYING")
+    license_path = os.path.join(
+        os.path.dirname(os.path.realpath(__file__)), "COPYING")
     if os.path.exists(license_path):
         with open(license_path) as f:
             info.License += f.read()
@@ -211,7 +182,7 @@
     return info
 
 
-app_version = "1.2"
-rev = GetAppRevision()
-if rev is not None:
-    app_version = app_version + "-" + rev.rstrip()
+app_version = "1.3-beta2"
+
+if __name__ == "__main__":
+    print(app_version)