mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
Add check_venv() to tools/diagnose script.
This commit is contained in:
@@ -6,7 +6,7 @@ import platform
|
|||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from typing import Callable
|
from typing import Callable, List
|
||||||
|
|
||||||
TOOLS_DIR = os.path.dirname(__file__)
|
TOOLS_DIR = os.path.dirname(__file__)
|
||||||
ROOT_DIR = os.path.dirname(TOOLS_DIR)
|
ROOT_DIR = os.path.dirname(TOOLS_DIR)
|
||||||
@@ -22,6 +22,11 @@ def run(check_func):
|
|||||||
if not rc:
|
if not rc:
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
|
def run_command(args):
|
||||||
|
# type: (List[str]) -> None
|
||||||
|
print(' '.join(args))
|
||||||
|
subprocess.check_call(args)
|
||||||
|
|
||||||
@run
|
@run
|
||||||
def check_python_version():
|
def check_python_version():
|
||||||
# type: () -> bool
|
# type: () -> bool
|
||||||
@@ -80,3 +85,17 @@ def test_models():
|
|||||||
print('Num users: ', UserProfile.objects.count())
|
print('Num users: ', UserProfile.objects.count())
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@run
|
||||||
|
def check_venv():
|
||||||
|
# type: () -> bool
|
||||||
|
path = os.path.join(ROOT_DIR, 'scripts', 'lib', 'hash_reqs.py')
|
||||||
|
cache_dir = '/srv/zulip-venv-cache/'
|
||||||
|
for fn in ['py2_dev.txt', 'py3_dev.txt']:
|
||||||
|
requirements_file = os.path.join(ROOT_DIR, "requirements", fn)
|
||||||
|
output = subprocess.check_output([path, requirements_file], universal_newlines=True)
|
||||||
|
sha1sum = output.split()[0]
|
||||||
|
print(fn, 'venv sha: ', sha1sum)
|
||||||
|
if not os.path.exists(os.path.join(cache_dir, sha1sum)):
|
||||||
|
print('Your venv may be improperly installed!')
|
||||||
|
return False
|
||||||
|
return True
|
||||||
|
|||||||
Reference in New Issue
Block a user