From 2d7466073348102ef22624ba247adff1ef07340a Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Mon, 4 Mar 2024 12:35:41 -0800 Subject: [PATCH] Don't git pull on "Install/update extensions requirements" --- one_click.py | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/one_click.py b/one_click.py index d68ebe46..65b7acbd 100644 --- a/one_click.py +++ b/one_click.py @@ -317,29 +317,30 @@ def install_extensions_requirements(): run_cmd(f"python -m pip install -r {extension_req_path} --upgrade", assert_success=False, environment=True) -def update_requirements(initial_installation=False): +def update_requirements(initial_installation=False, pull=True): # Create .git directory if missing if not os.path.exists(os.path.join(script_dir, ".git")): git_creation_cmd = 'git init -b main && git remote add origin https://github.com/oobabooga/text-generation-webui && git fetch && git symbolic-ref refs/remotes/origin/HEAD refs/remotes/origin/main && git reset --hard origin/main && git branch --set-upstream-to=origin/main' run_cmd(git_creation_cmd, environment=True, assert_success=True) - files_to_check = [ - 'start_linux.sh', 'start_macos.sh', 'start_windows.bat', 'start_wsl.bat', - 'update_linux.sh', 'update_macos.sh', 'update_windows.bat', 'update_wsl.bat', - 'one_click.py' - ] + if pull: + print_big_message("Updating the local copy of the repository with \"git pull\"") - print_big_message("Updating the local copy of the repository with \"git pull\"") + files_to_check = [ + 'start_linux.sh', 'start_macos.sh', 'start_windows.bat', 'start_wsl.bat', + 'update_linux.sh', 'update_macos.sh', 'update_windows.bat', 'update_wsl.bat', + 'one_click.py' + ] - before_pull_hashes = {file_name: calculate_file_hash(file_name) for file_name in files_to_check} - run_cmd("git pull --autostash", assert_success=True, environment=True) - after_pull_hashes = {file_name: calculate_file_hash(file_name) for file_name in files_to_check} + before_pull_hashes = {file_name: calculate_file_hash(file_name) for file_name in files_to_check} + run_cmd("git pull --autostash", assert_success=True, environment=True) + after_pull_hashes = {file_name: calculate_file_hash(file_name) for file_name in files_to_check} - # Check for differences in installation file hashes - for file_name in files_to_check: - if before_pull_hashes[file_name] != after_pull_hashes[file_name]: - print_big_message(f"File '{file_name}' was updated during 'git pull'. Please run the script again.") - exit(1) + # Check for differences in installation file hashes + for file_name in files_to_check: + if before_pull_hashes[file_name] != after_pull_hashes[file_name]: + print_big_message(f"File '{file_name}' was updated during 'git pull'. Please run the script again.") + exit(1) # Update PyTorch if not initial_installation: @@ -427,7 +428,7 @@ if __name__ == "__main__": update_requirements() elif choice == 'B': install_extensions_requirements() - update_requirements() + update_requirements(pull=False) elif choice == 'C': run_cmd("git reset --hard", assert_success=True, environment=True) elif choice == 'N':