summaryrefslogtreecommitdiff
path: root/lib/utils/version.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils/version.py')
-rw-r--r--lib/utils/version.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/utils/version.py b/lib/utils/version.py
new file mode 100644
index 00000000..02eb388b
--- /dev/null
+++ b/lib/utils/version.py
@@ -0,0 +1,17 @@
+import sys
+from os.path import isfile, join, realpath
+
+from ..i18n import _
+
+
+def get_inkstitch_version():
+ if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
+ version = realpath(join(sys._MEIPASS, "..", "VERSION"))
+ else:
+ version = realpath(join(realpath(__file__), "..", "..", "..", 'VERSION'))
+ if isfile(version):
+ with open(version, 'r') as v:
+ inkstitch_version = _("Ink/Stitch Version: %s") % v.readline()
+ else:
+ inkstitch_version = _("Ink/Stitch Version: unkown")
+ return inkstitch_version