2017-04-03 11:48:57 +02:00
|
|
|
import os
|
|
|
|
import pwd
|
2017-02-05 21:24:28 +01:00
|
|
|
import sys
|
|
|
|
|
|
|
|
def check_venv(filename):
|
|
|
|
# type: (str) -> None
|
|
|
|
try:
|
2017-10-15 04:19:37 +02:00
|
|
|
import django
|
2017-02-05 21:24:28 +01:00
|
|
|
import ujson
|
2017-10-15 04:19:37 +02:00
|
|
|
import zulip
|
2017-02-05 21:24:28 +01:00
|
|
|
except ImportError:
|
|
|
|
print("You need to run %s inside a Zulip dev environment." % (filename,))
|
2017-04-03 11:48:57 +02:00
|
|
|
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:
|
2017-11-08 03:47:28 +01:00
|
|
|
print("You can `source /srv/zulip-py3-venv/bin/activate` "
|
|
|
|
"to enter the Zulip development environment.")
|
2017-02-05 21:24:28 +01:00
|
|
|
sys.exit(1)
|