Skip to content

Commit

Permalink
fix __init__.py's js files operator to try block
Browse files Browse the repository at this point in the history
  • Loading branch information
chflame163 committed Oct 28, 2024
1 parent 2272d9d commit c49a40f
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 26 deletions.
52 changes: 27 additions & 25 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,35 +10,37 @@
NODE_DISPLAY_NAME_MAPPINGS = {}

python = sys.executable
extentions_folder = os.path.join(os.path.dirname(os.path.realpath(__main__.__file__)),
"web" + os.sep + "extensions" + os.sep + "dzNodes")
javascript_folder = os.path.join(os.path.dirname(os.path.realpath(__file__)), "js")
outdate_file_list = ['comfy_shared.js', 'debug.js', 'mtb_widgets.js', 'parse-css.js', 'dz_widgets.js']
try:
extentions_folder = os.path.join(os.path.dirname(os.path.realpath(__main__.__file__)),
"web" + os.sep + "extensions" + os.sep + "dzNodes")
javascript_folder = os.path.join(os.path.dirname(os.path.realpath(__file__)), "js")
outdate_file_list = ['comfy_shared.js', 'debug.js', 'mtb_widgets.js', 'parse-css.js', 'dz_widgets.js']

if not os.path.exists(extentions_folder):
print('# 😺dzNodes: Making the "web\extensions\dzNodes" folder')
os.mkdir(extentions_folder)
else:
for i in outdate_file_list:
outdate_file = os.path.join(extentions_folder, i)
if os.path.exists(outdate_file):
os.remove(outdate_file)
if not os.path.exists(extentions_folder):
print('# 😺dzNodes: Making the "web\extensions\dzNodes" folder')
os.mkdir(extentions_folder)
else:
for i in outdate_file_list:
outdate_file = os.path.join(extentions_folder, i)
if os.path.exists(outdate_file):
os.remove(outdate_file)

result = filecmp.dircmp(javascript_folder, extentions_folder)
result = filecmp.dircmp(javascript_folder, extentions_folder)

if result.left_only or result.diff_files:
print('# 😺dzNodes: Update to javascripts files detected')
file_list = list(result.left_only)
file_list.extend(x for x in result.diff_files if x not in file_list)

for file in file_list:
print(f'# 😺dzNodes:: Copying {file} to extensions folder')
src_file = os.path.join(javascript_folder, file)
dst_file = os.path.join(extentions_folder, file)
if os.path.exists(dst_file):
os.remove(dst_file)
shutil.copy(src_file, dst_file)
if result.left_only or result.diff_files:
print('# 😺dzNodes: Update to javascripts files detected')
file_list = list(result.left_only)
file_list.extend(x for x in result.diff_files if x not in file_list)

for file in file_list:
print(f'# 😺dzNodes:: Copying {file} to extensions folder')
src_file = os.path.join(javascript_folder, file)
dst_file = os.path.join(extentions_folder, file)
if os.path.exists(dst_file):
os.remove(dst_file)
shutil.copy(src_file, dst_file)
except Exception as e:
print(f'# 😺dzNodes: Error in update js files: {e}')

def get_ext_dir(subpath=None, mkdir=False):
dir = os.path.dirname(__file__)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "comfyui_layerstyle"
description = "A set of nodes for ComfyUI it generate image like Adobe Photoshop's Layer Style. the Drop Shadow is first completed node, and follow-up work is in progress."
version = "1.0.83"
version = "1.0.84"
license = "MIT"
dependencies = ["numpy", "pillow", "torch", "matplotlib", "Scipy", "scikit_image", "scikit_learn", "opencv-contrib-python", "pymatting", "segment_anything", "timm", "addict", "yapf", "colour-science", "wget", "mediapipe", "loguru", "typer_config", "fastapi", "rich", "google-generativeai", "diffusers", "omegaconf", "tqdm", "transformers", "kornia", "image-reward", "ultralytics", "blend_modes", "blind-watermark", "qrcode", "pyzbar", "transparent-background", "huggingface_hub", "accelerate", "bitsandbytes", "torchscale", "wandb", "hydra-core", "psd-tools", "inference-cli[yolo-world]", "inference-gpu[yolo-world]", "onnxruntime", "peft", "iopath"]

Expand Down

0 comments on commit c49a40f

Please sign in to comment.