sanity_check: Test for the virtualenv by its path.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-08-11 12:03:52 -07:00 committed by Tim Abbott
parent 94839c9492
commit 42aa916967
1 changed files with 1 additions and 11 deletions

View File

@ -4,17 +4,7 @@ import sys
def check_venv(filename: str) -> None: def check_venv(filename: str) -> None:
try: if os.path.basename(sys.prefix) != "zulip-py3-venv":
# Here we import 3 modules that we expect to be in any valid
# Zulip virtualenv but are unlikely to all be present on a
# host system to help check whether we're in Vagrant.
import bitfield
import django
import zulip
bitfield
django
zulip
except ImportError:
print(f"You need to run {filename} inside a Zulip dev environment.") print(f"You need to run {filename} inside a Zulip dev environment.")
user_id = os.getuid() user_id = os.getuid()
user_name = pwd.getpwuid(user_id).pw_name user_name = pwd.getpwuid(user_id).pw_name