From a261a2d47dfbd455b3d9005f56dd4806c6df268e Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Fri, 14 Jun 2024 09:43:30 +0530 Subject: [PATCH 1/2] Fix #1779 - add to PATH only if it isn't present, to avoid exploding the PATH variable each time the function is called --- ui/easydiffusion/device_manager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ui/easydiffusion/device_manager.py b/ui/easydiffusion/device_manager.py index dc705927..9b0f3f5e 100644 --- a/ui/easydiffusion/device_manager.py +++ b/ui/easydiffusion/device_manager.py @@ -243,7 +243,8 @@ def get_processor_name(): if platform.system() == "Windows": return platform.processor() elif platform.system() == "Darwin": - os.environ["PATH"] = os.environ["PATH"] + os.pathsep + "/usr/sbin" + if "/usr/sbin" not in os.environ["PATH"].split(os.pathsep): + os.environ["PATH"] = os.environ["PATH"] + os.pathsep + "/usr/sbin" command = "sysctl -n machdep.cpu.brand_string" return subprocess.check_output(command, shell=True).decode().strip() elif platform.system() == "Linux": From 364902f8a1b99f4a3af4454122f8559ec06905e3 Mon Sep 17 00:00:00 2001 From: cmdr2 Date: Fri, 14 Jun 2024 09:48:49 +0530 Subject: [PATCH 2/2] Ignore text in the version string when comparing them --- scripts/check_modules.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/check_modules.py b/scripts/check_modules.py index 7d86c133..9a067e68 100644 --- a/scripts/check_modules.py +++ b/scripts/check_modules.py @@ -15,6 +15,7 @@ import traceback import shutil from pathlib import Path from pprint import pprint +import re os_name = platform.system() @@ -225,6 +226,7 @@ def install_pkg_if_necessary(pkg_name, required_version): def version_str_to_tuple(ver_str): ver_str = ver_str.split("+")[0] + ver_str = re.sub("[^0-9.]", "", ver_str) ver = ver_str.split(".") return tuple(map(int, ver))