summaryrefslogtreecommitdiff
path: root/lib/utils
diff options
context:
space:
mode:
authorKaalleen <36401965+kaalleen@users.noreply.github.com>2024-06-23 10:58:16 +0200
committerGitHub <noreply@github.com>2024-06-23 10:58:16 +0200
commit7a856a77e4d36a077cb1a5a1c50831463a6692a0 (patch)
tree05557c9609ab2c7ea37de161bfa2707804fd1e72 /lib/utils
parentca07e28effeb7c097e7d99ef8ef925fd204184e0 (diff)
wxpythonify about extension (#3007)
Diffstat (limited to 'lib/utils')
-rwxr-xr-xlib/utils/version.py29
1 files changed, 22 insertions, 7 deletions
diff --git a/lib/utils/version.py b/lib/utils/version.py
index 0b46669a..eaa539b8 100755
--- a/lib/utils/version.py
+++ b/lib/utils/version.py
@@ -10,16 +10,31 @@ from ..i18n import _
def get_inkstitch_version():
- if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
- if sys.platform == "darwin":
- version = realpath(join(sys._MEIPASS, "..", 'Resources', "VERSION"))
- else:
- version = realpath(join(sys._MEIPASS, "..", "VERSION"))
- else:
- version = realpath(join(realpath(__file__), "..", "..", "..", 'VERSION'))
+ version = _get_source_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: unknown")
return inkstitch_version
+
+
+def get_inkstitch_license():
+ license = _get_source_file("LICENSE")
+ if isfile(license):
+ with open(license, 'r') as lcs:
+ license = lcs.read()
+ else:
+ license = "License: GNU GENERAL PUBLIC LICENSE\nVersion 3, 29 June 2007"
+ return license
+
+
+def _get_source_file(filename):
+ if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
+ if sys.platform == "darwin":
+ source_file = realpath(join(sys._MEIPASS, "..", 'Resources', filename))
+ else:
+ source_file = realpath(join(sys._MEIPASS, "..", filename))
+ else:
+ source_file = realpath(join(realpath(__file__), "..", "..", "..", filename))
+ return source_file