improve: try execute disable.py if uninstall.py not exists
update DB
This commit is contained in:
12
__init__.py
12
__init__.py
@@ -33,7 +33,7 @@ sys.path.append('../..')
|
||||
from torchvision.datasets.utils import download_url
|
||||
|
||||
# ensure .js
|
||||
print("### Loading: ComfyUI-Manager (V0.17.1)")
|
||||
print("### Loading: ComfyUI-Manager (V0.17.2)")
|
||||
|
||||
comfy_ui_revision = "Unknown"
|
||||
|
||||
@@ -679,19 +679,25 @@ def gitclone_uninstall(files):
|
||||
dir_name = os.path.splitext(os.path.basename(url))[0].replace(".git", "")
|
||||
dir_path = os.path.join(custom_nodes_path, dir_name)
|
||||
|
||||
# safey check
|
||||
# safety check
|
||||
if dir_path == '/' or dir_path[1:] == ":/" or dir_path == '':
|
||||
print(f"Uninstall(git-clone) error: invalid path '{dir_path}' for '{url}'")
|
||||
return False
|
||||
|
||||
install_script_path = os.path.join(dir_path, "uninstall.py")
|
||||
disable_script_path = os.path.join(dir_path, "disable.py")
|
||||
if os.path.exists(install_script_path):
|
||||
uninstall_cmd = [sys.executable, "uninstall.py"]
|
||||
code = subprocess.run(uninstall_cmd, cwd=dir_path)
|
||||
|
||||
if code.returncode != 0:
|
||||
print(f"An error occurred during the execution of the uninstall.py script. Only the '{dir_path}' will be deleted.")
|
||||
|
||||
elif os.path.exists(disable_script_path):
|
||||
disable_script = [sys.executable, "disable.py"]
|
||||
code = subprocess.run(disable_script, cwd=dir_path)
|
||||
if code.returncode != 0:
|
||||
print(f"An error occurred during the execution of the disable.py script. Only the '{dir_path}' will be deleted.")
|
||||
|
||||
if os.path.exists(dir_path):
|
||||
rmtree(dir_path)
|
||||
elif os.path.exists(dir_path + ".disabled"):
|
||||
|
||||
Reference in New Issue
Block a user