provision: Don't fail on mypy install for Python 2.
This commit is contained in:
parent
3fb640a5d0
commit
123c49291a
1
py3_requirements.txt
Normal file
1
py3_requirements.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
mypy==0.521
|
|
@ -1,5 +1,4 @@
|
||||||
coverage>=4.4.1
|
coverage>=4.4.1
|
||||||
mypy==0.521
|
|
||||||
pycodestyle==2.3.1
|
pycodestyle==2.3.1
|
||||||
-e ./zulip
|
-e ./zulip
|
||||||
-e ./zulip_bots
|
-e ./zulip_bots
|
||||||
|
|
|
@ -6,6 +6,7 @@ import argparse
|
||||||
import pip
|
import pip
|
||||||
import six
|
import six
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import warnings
|
||||||
|
|
||||||
from importlib import import_module
|
from importlib import import_module
|
||||||
|
|
||||||
|
@ -49,10 +50,17 @@ the Python version this command is executed with."""
|
||||||
# In order to install all required packages for the venv, `pip` needs to be executed by
|
# In order to install all required packages for the venv, `pip` needs to be executed by
|
||||||
# the venv's Python interpreter. `--prefix venv_dir` ensures that all modules are installed
|
# the venv's Python interpreter. `--prefix venv_dir` ensures that all modules are installed
|
||||||
# in the right place.
|
# in the right place.
|
||||||
|
def install_dependencies(requirements_filename):
|
||||||
if subprocess.call([os.path.join(venv_dir, venv_exec_dir, 'pip'),
|
if subprocess.call([os.path.join(venv_dir, venv_exec_dir, 'pip'),
|
||||||
'install', '--prefix', venv_dir, '-r', os.path.join(base_dir, 'requirements.txt')]):
|
'install', '--prefix', venv_dir, '-r', os.path.join(base_dir, requirements_filename)]):
|
||||||
raise OSError("The command `pip install -r {}` failed. Dependencies not installed!"
|
raise OSError("The command `pip install -r {}` failed. Dependencies not installed!"
|
||||||
.format(os.path.join(base_dir, 'requirements.txt')))
|
.format(os.path.join(base_dir, requirements_filename)))
|
||||||
|
|
||||||
|
install_dependencies('requirements.txt')
|
||||||
|
if sys.version_info > (3, 1):
|
||||||
|
install_dependencies('py3_requirements.txt')
|
||||||
|
else:
|
||||||
|
warnings.warn("Your Python version does not support mypy. `tools/run-mypy` will fail.")
|
||||||
|
|
||||||
print("{green}Success!{end_format} Run\n {bold}source '{activate}'{end_format}\nto activate virtualenv.".format(
|
print("{green}Success!{end_format} Run\n {bold}source '{activate}'{end_format}\nto activate virtualenv.".format(
|
||||||
green='\033[92m', bold='\033[1m', end_format='\033[0m',
|
green='\033[92m', bold='\033[1m', end_format='\033[0m',
|
||||||
|
|
Loading…
Reference in a new issue