Add no deps.

This commit is contained in:
Robin Huang 2024-11-29 16:03:56 -08:00
parent 41dc407626
commit 02307e6435

View File

@ -83,6 +83,10 @@ class Ctx:
self.mode = 'remote'
self.processed_install = set()
self.custom_node_map_cache = None
self.no_deps = False
def set_no_deps(self, no_deps):
self.no_deps = no_deps
def set_channel_mode(self, channel, mode):
if mode is not None:
@ -202,7 +206,7 @@ class Ctx:
cm_ctx = Ctx()
def install_node(node_name, is_all=False, cnt_msg='', install_path=None):
def install_node(node_name, is_all=False, cnt_msg='', install_path=None, no_deps=False):
if core.is_valid_url(node_name):
# install via urls
print(f"Installing {node_name} to {install_path}")
@ -220,7 +224,7 @@ def install_node(node_name, is_all=False, cnt_msg='', install_path=None):
elif os.path.exists(node_path + '.disabled'):
enable_node(node_name)
else:
res = core.gitclone_install(node_item['files'], instant_execution=True, msg_prefix=f"[{cnt_msg}] ", install_path=install_path)
res = core.gitclone_install(node_item['files'], instant_execution=True, msg_prefix=f"[{cnt_msg}] ", install_path=install_path, no_deps=no_deps)
if not res:
print(f"[bold red]ERROR: An error occurred while installing '{node_name}'.[/bold red]")
else:
@ -470,7 +474,7 @@ def auto_save_snapshot():
print(f"Current snapshot is saved as `{path}`")
def for_each_nodes(nodes, act, allow_all=True, install_path=None):
def for_each_nodes(nodes, act, allow_all=True, install_path=None, no_deps=False):
is_all = False
if allow_all and 'all' in nodes:
is_all = True
@ -482,7 +486,7 @@ def for_each_nodes(nodes, act, allow_all=True, install_path=None):
i = 1
for x in nodes:
try:
act(x, is_all=is_all, cnt_msg=f'{i}/{total}', install_path=install_path)
act(x, is_all=is_all, cnt_msg=f'{i}/{total}', install_path=install_path, no_deps=no_deps)
except Exception as e:
print(f"ERROR: {e}")
traceback.print_exc()
@ -518,9 +522,18 @@ def install(
None,
help="Specify the installation path"
),
no_deps: Annotated[
Optional[bool],
typer.Option(
"--no-deps",
show_default=False,
help="Skip installing any Python dependencies",
),
] = False,
):
cm_ctx.set_channel_mode(channel, mode)
for_each_nodes(nodes, act=install_node, install_path=install_path)
cm_ctx.set_no_deps(no_deps)
for_each_nodes(nodes, act=install_node, install_path=install_path, no_deps=no_deps)
@app.command(help="Reinstall custom nodes")