MCPcopy
hub / github.com/pythongosssss/ComfyUI-Custom-Scripts / install_js

Function install_js

pysssss.py:121–153  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

119
120
121def install_js():
122 src_dir = get_ext_dir("web/js")
123 if not os.path.exists(src_dir):
124 log("No JS")
125 return
126
127 should_install = should_install_js()
128 if should_install:
129 log("it looks like you're running an old version of ComfyUI that requires manual setup of web files, it is recommended you update your installation.", "warning", True)
130 dst_dir = get_web_ext_dir()
131 linked = os.path.islink(dst_dir) or is_junction(dst_dir)
132 if linked or os.path.exists(dst_dir):
133 if linked:
134 if should_install:
135 log("JS already linked")
136 else:
137 os.unlink(dst_dir)
138 log("JS unlinked, PromptServer will serve extension")
139 elif not should_install:
140 shutil.rmtree(dst_dir)
141 log("JS deleted, PromptServer will serve extension")
142 return
143
144 if not should_install:
145 log("JS skipped, PromptServer will serve extension")
146 return
147
148 if link_js(src_dir, dst_dir):
149 log("JS linked")
150 return
151
152 log("Copying JS files")
153 shutil.copytree(src_dir, dst_dir, dirs_exist_ok=True)
154
155
156def should_install_js():

Callers 1

initFunction · 0.85

Calls 6

get_ext_dirFunction · 0.85
logFunction · 0.85
should_install_jsFunction · 0.85
get_web_ext_dirFunction · 0.85
is_junctionFunction · 0.85
link_jsFunction · 0.85

Tested by

no test coverage detected