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.

setup_path: Ensure that the right venv is activated.

Alex Vandiver6c1a8185aacb
diff --git a/scripts/lib/setup_path.py b/scripts/lib/setup_path.py
index 2eb1a27803d..751038c19fa 100644
--- a/scripts/lib/setup_path.py
+++ b/scripts/lib/setup_path.py
@@ -7,9 +7,10 @@ import sys
def setup_path() -> None:
- if os.path.basename(sys.prefix) != "zulip-py3-venv":
- BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
- venv = os.path.join(BASE_DIR, "zulip-py3-venv")
+ BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
+ venv = os.path.realpath(os.path.join(BASE_DIR, "zulip-py3-venv"))
+ if sys.prefix != venv:
+ sys.path = list(filter(lambda p: "/zulip-py3-venv/" not in p, sys.path))
activate_this = os.path.join(venv, "bin", "activate_this.py")
activate_locals = dict(__file__=activate_this)
with open(activate_this) as f: