summaryrefslogtreecommitdiff
path: root/lib/exceptions.py
diff options
context:
space:
mode:
authorrejbasket <39080670+rejbasket@users.noreply.github.com>2024-02-10 20:16:30 +0100
committerGitHub <noreply@github.com>2024-02-10 20:16:30 +0100
commitd929336f08f08e0b8c6a054df2367d24af92dd11 (patch)
tree3fdfaba288e5abf9bbcab75c45a265d2ff1fcbe0 /lib/exceptions.py
parent87d7fa387dfafabe77ffc5fd0fa6ca3494744d66 (diff)
Rejbasket/pyinstaller fix installer checks (#2718)
* netowrkx deps added in build * check for user inkscape config before installing * get os version in exception * update electron app location according to pyinstaller redesign * fixed broken libgeos syslinks * contents-directory added pyinstaller args fix broken linux and win versions * updated inkex * fix print_pdf --------- authored-by: rejbasket
Diffstat (limited to 'lib/exceptions.py')
-rw-r--r--lib/exceptions.py30
1 files changed, 29 insertions, 1 deletions
diff --git a/lib/exceptions.py b/lib/exceptions.py
index 3a6b456c..8bef185f 100644
--- a/lib/exceptions.py
+++ b/lib/exceptions.py
@@ -3,12 +3,38 @@
# Copyright (c) 2010 Authors
# Licensed under the GNU GPL version 3.0 or later. See the file LICENSE for details.
import traceback
+import sys
+import platform
+import subprocess
+from glob import glob
class InkstitchException(Exception):
pass
+def get_os_version():
+ if sys.platform == "win32":
+ # To get the windows version, python functions are used
+ # Using python subprocess with cmd.exe in windows is currently a security risk
+ os_ver = "Windows " + platform.release() + " version: " + platform.version()
+ if sys.platform == "darwin":
+ # macOS command line progam provides accurate info than python functions
+ mac_v = subprocess.run(["sw_vers"], capture_output=True, text=True)
+ os_ver = str(mac_v.stdout.strip())
+ if sys.platform == "linux":
+ # Getting linux version method used here is for systemd and nonsystemd linux.
+ try:
+ ltmp = subprocess.run(["cat"] + glob("/etc/*-release"), capture_output=True, text=True)
+ lnx_ver = ltmp.stdout.splitlines()
+ lnx_ver = str(list(filter(lambda x: "PRETTY_NAME" in x, lnx_ver)))
+ os_ver = lnx_ver[15:][:-3]
+ except FileNotFoundError:
+ os_ver = "Cannot get Linux distro version"
+
+ return os_ver
+
+
def format_uncaught_exception():
"""Format the current exception as a request for a bug report.
@@ -30,7 +56,9 @@ def format_uncaught_exception():
"- create a new issue at")
message += " https://github.com/inkstitch/inkstitch/issues/new\n\n"
message += _("Include the error description and also (if possible) the svg file.")
- message += '\n\n\n'
+ message += '\n\n'
+ message += get_os_version()
+ message += '\n\n'
message += version.get_inkstitch_version() + '\n'
message += traceback.format_exc()