added support for --no-deps option to node install and reinstall (#886)

* added support for `--no-deps` option to node install and reinstall

* post rebase fixup

* fixup help msg for --no-deps option
This commit is contained in:
Max Klein
2024-07-26 12:52:07 -04:00
committed by GitHub
parent b3be556837
commit f0299e07f9
3 changed files with 66 additions and 41 deletions

View File

@@ -80,6 +80,7 @@ read_downgrade_blacklist() # This is a preparation step for manager_core
class Ctx:
def __init__(self):
self.channel = 'default'
self.no_deps = False
self.mode = 'cache'
def set_channel_mode(self, channel, mode):
@@ -100,6 +101,9 @@ class Ctx:
asyncio.run(unified_manager.reload(cache_mode=self.mode == 'cache'))
asyncio.run(unified_manager.load_nightly(self.channel, self.mode))
def set_no_deps(self, no_deps):
self.no_deps = no_deps
channel_ctx = Ctx()
@@ -107,7 +111,7 @@ channel_ctx = Ctx()
def install_node(node_spec_str, is_all=False, cnt_msg=''):
if core.is_valid_url(node_spec_str):
# install via urls
res = asyncio.run(core.gitclone_install(node_spec_str))
res = asyncio.run(core.gitclone_install(node_spec_str, no_deps=channel_ctx.no_deps))
if not res.result:
print(res.msg)
print(f"[bold red]ERROR: An error occurred while installing '{node_spec_str}'.[/bold red]")
@@ -125,7 +129,7 @@ def install_node(node_spec_str, is_all=False, cnt_msg=''):
if not is_specified:
version_spec = None
res = asyncio.run(unified_manager.install_by_id(node_name, version_spec, channel_ctx.channel, channel_ctx.mode, instant_execution=True))
res = asyncio.run(unified_manager.install_by_id(node_name, version_spec, channel_ctx.channel, channel_ctx.mode, instant_execution=True, no_deps=channel_ctx.no_deps))
if res.action == 'skip':
print(f"{cnt_msg} [ SKIP ] {node_name:50} => Already installed")
@@ -171,7 +175,7 @@ def fix_node(node_spec_str, is_all=False, cnt_msg=''):
node_name, version_spec, _ = node_spec
print(f"{cnt_msg} [ FIXING ]: {node_name:50}[{version_spec}]")
res = unified_manager.unified_fix(node_name, version_spec)
res = unified_manager.unified_fix(node_name, version_spec, no_deps=channel_ctx.no_deps)
if not res.result:
print(f"ERROR: f{res.msg}")
@@ -211,7 +215,7 @@ def update_node(node_spec_str, is_all=False, cnt_msg=''):
node_name, version_spec, _ = node_spec
res = unified_manager.unified_update(node_name, version_spec, return_postinstall=True)
res = unified_manager.unified_update(node_name, version_spec, no_deps=channel_ctx.no_deps, return_postinstall=True)
if not res.result:
print(f"ERROR: An error occurred while updating '{node_name}'.")
@@ -549,9 +553,18 @@ def install(
mode: str = typer.Option(
None,
help="[remote|local|cache]"
)
),
no_deps: Annotated[
Optional[bool],
typer.Option(
"--no-deps",
show_default=False,
help="Skip installing any Python dependencies",
),
] = False,
):
channel_ctx.set_channel_mode(channel, mode)
channel_ctx.set_no_deps(no_deps)
for_each_nodes(nodes, act=install_node)
@@ -571,8 +584,17 @@ def reinstall(
None,
help="[remote|local|cache]"
),
no_deps: Annotated[
Optional[bool],
typer.Option(
"--no-deps",
show_default=False,
help="Skip installing any Python dependencies",
),
] = False,
):
channel_ctx.set_channel_mode(channel, mode)
channel_ctx.set_no_deps(no_deps)
for_each_nodes(nodes, act=reinstall_node)