Update update_script.py

This commit is contained in:
Saifeddine ALOUI 2024-09-03 09:36:04 +02:00 committed by GitHub
parent 189fa0fb73
commit c33ae84156
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,11 +38,15 @@ def run_git_pull():
error_message = f"Failed to update the code: {str(e)}"
ASCIIColors.error(error_message)
show_error_dialog(error_message)
return False
print("Updating submodules")
try:
repo.git.submodule('update', '--init', '--recursive', '--force')
except Exception as ex:
error_message = f"Couldn't update submodules: {str(ex)}"
ASCIIColors.error(error_message)
show_error_dialog(error_message)
try:
# Checkout the main branch on each submodule
for submodule in repo.submodules:
try:
@ -55,7 +59,11 @@ def run_git_pull():
print(f"Couldn't update submodule {submodule}: {str(ex)}")
execution_path = Path(os.getcwd())
except Exception as ex:
error_message = f"Couldn't update submodules: {str(ex)}"
ASCIIColors.error(error_message)
show_error_dialog(error_message)
try:
# Update lollms_core
ASCIIColors.info("Updating lollms_core")
lollms_core_path = execution_path / "lollms_core"
@ -71,7 +79,6 @@ def run_git_pull():
error_message = f"Couldn't update submodules: {str(ex)}"
ASCIIColors.error(error_message)
show_error_dialog(error_message)
return False
return True
except Exception as e: