diff --git a/src/Mod/Path/InitGui.py b/src/Mod/Path/InitGui.py index 85a6be3433..9fa9b32c52 100644 --- a/src/Mod/Path/InitGui.py +++ b/src/Mod/Path/InitGui.py @@ -89,6 +89,7 @@ class PathWorkbench(Workbench): import PathCommands import subprocess + from packaging.version import Version, parse PathGuiInit.Startup() @@ -162,11 +163,11 @@ class PathWorkbench(Workbench): r = subprocess.run( ["camotics", "--version"], capture_output=True, text=True ).stderr.strip() - major, minor, patch = r.split(".") - if int(major) >= 1 and int(minor) >= 2 and int(patch) >= 2: - # subprocess.call(["camsim", "-v"]) + v = parse(r) + + if v >= Version("1.2.2"): toolcmdlist.append("Path_Camotics") - except FileNotFoundError: + except (FileNotFoundError, ModuleNotFoundError): pass try: diff --git a/src/Mod/Path/PathScripts/PathGuiInit.py b/src/Mod/Path/PathScripts/PathGuiInit.py index 5786c507bb..fca0052a5a 100644 --- a/src/Mod/Path/PathScripts/PathGuiInit.py +++ b/src/Mod/Path/PathScripts/PathGuiInit.py @@ -78,14 +78,18 @@ def Startup(): from PathScripts import PathUtilsGui from PathScripts import PathVcarveGui + from packaging.version import Version, parse + # If camotics is installed and current enough, import the GUI try: import camotics + r = subprocess.run( ["camotics", "--version"], capture_output=True, text=True ).stderr.strip() - major, minor, patch = r.split(".") - if int(major) >= 1 and int(minor) >= 2 and int(patch) >= 2: + + v = parse(r) + if v >= Version("1.2.2"): from PathScripts import PathCamoticsGui except (FileNotFoundError, ModuleNotFoundError): pass