From 34281c2e149d2d7a7d4dd611b789f839ea93833e Mon Sep 17 00:00:00 2001 From: kingbri Date: Sun, 4 Aug 2024 11:14:38 -0400 Subject: [PATCH] Start: Add --force-reinstall argument Forces a reinstall of dependencies in the event that one is corrupted or broken. Signed-off-by: kingbri --- start.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/start.py b/start.py index 7eda6e1..490570e 100644 --- a/start.py +++ b/start.py @@ -108,6 +108,12 @@ def add_start_args(parser: argparse.ArgumentParser): action="store_true", help="Update all pip dependencies", ) + start_group.add_argument( + "-fr", + "--force-reinstall", + action="store_true", + help="Forces a reinstall of dependencies. Only works with --update-deps", + ) start_group.add_argument( "-nw", "--nowheel", @@ -198,13 +204,19 @@ if __name__ == "__main__": subprocess.run(pull_command.split(" ")) if first_run or args.update_deps: + install_command = ["pip", "install", "-U"] + + # Force a reinstall of the updated dependency if needed + if args.force_reinstall: + install_command.append("--force-reinstall") + install_features = None if args.nowheel else get_install_features(gpu_lib) - features = f"[{install_features}]" if install_features else "" + features = f".[{install_features}]" if install_features else "." + install_command.append(features) # pip install .[features] - install_command = f"pip install -U .{features}" - print(f"Running install command: {install_command}") - subprocess.run(install_command.split(" ")) + print(f"Running install command: {' '.join(install_command)}") + subprocess.run(install_command) print() if args.update_deps: