Files
zulip/tools/lib/sanity_check.py
Anders Kaseorg 365fe0b3d5 python: Sort imports with isort.
Fixes #2665.

Regenerated by tabbott with `lint --fix` after a rebase and change in
parameters.

Note from tabbott: In a few cases, this converts technical debt in the
form of unsorted imports into different technical debt in the form of
our largest files having very long, ugly import sequences at the
start.  I expect this change will increase pressure for us to split
those files, which isn't a bad thing.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-06-11 16:45:32 -07:00

24 lines
700 B
Python

import os
import pwd
import sys
def check_venv(filename: str) -> None:
try:
import django
import ujson
import zulip
django
ujson
zulip
except ImportError:
print(f"You need to run {filename} inside a Zulip dev environment.")
user_id = os.getuid()
user_name = pwd.getpwuid(user_id).pw_name
if user_name != 'vagrant' and user_name != 'zulipdev':
print("If you are using Vagrant, you can `vagrant ssh` to enter the Vagrant guest.")
else:
print("You can `source /srv/zulip-py3-venv/bin/activate` "
"to enter the Zulip development environment.")
sys.exit(1)