Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

provision: Suppress exception chaining for CalledProcessError retries.

Anders Kaseorgccad00b7e9e9
diff --git a/scripts/lib/setup_venv.py b/scripts/lib/setup_venv.py
index e1b50229a76..3b0ff751ef3 100644
--- a/scripts/lib/setup_venv.py
+++ b/scripts/lib/setup_venv.py
@@ -354,8 +354,12 @@ def do_setup_virtualenv(venv_path: str, requirements_file: str) -> None:
try:
install_venv_deps(pip, requirements_file)
except subprocess.CalledProcessError:
- # Might be a failure due to network connection issues. Retrying...
- print(WARNING + "`pip install` failed; retrying..." + ENDC)
- install_venv_deps(pip, requirements_file)
+ try:
+ # Might be a failure due to network connection issues. Retrying...
+ print(WARNING + "`pip install` failed; retrying..." + ENDC)
+ install_venv_deps(pip, requirements_file)
+ except BaseException as e:
+ # Suppress exception chaining
+ raise e from None
run_as_root(["chmod", "-R", "a+rX", venv_path])
diff --git a/tools/lib/provision.py b/tools/lib/provision.py
index 9f1723fea65..d5975c061e7 100755
--- a/tools/lib/provision.py
+++ b/tools/lib/provision.py
@@ -368,9 +368,13 @@ def main(options: argparse.Namespace) -> "NoReturn":
try:
install_system_deps()
except subprocess.CalledProcessError:
- # Might be a failure due to network connection issues. Retrying...
- print(WARNING + "Installing system dependencies failed; retrying..." + ENDC)
- install_system_deps()
+ try:
+ # Might be a failure due to network connection issues. Retrying...
+ print(WARNING + "Installing system dependencies failed; retrying..." + ENDC)
+ install_system_deps()
+ except BaseException as e:
+ # Suppress exception chaining
+ raise e from None
with open(apt_hash_file_path, "w") as hash_file:
hash_file.write(new_apt_dependencies_hash)
else: