Make venv creation with Python 2 harder.
Python 2 venvs can now only be created with tools/provision --force.
This commit is contained in:
parent
1e5e931421
commit
4ca11fdd67
|
@ -11,7 +11,7 @@ matrix:
|
||||||
- python: "3.6"
|
- python: "3.6"
|
||||||
env: TEST_SUITE=test-static-analysis
|
env: TEST_SUITE=test-static-analysis
|
||||||
install:
|
install:
|
||||||
- tools/provision
|
- tools/provision --force
|
||||||
- source zulip-api-py*-venv/bin/activate
|
- source zulip-api-py*-venv/bin/activate
|
||||||
script:
|
script:
|
||||||
- tools/$TEST_SUITE
|
- tools/$TEST_SUITE
|
||||||
|
|
|
@ -13,7 +13,7 @@ sys.path.append(ZULIP_BOTS_DIR)
|
||||||
|
|
||||||
import generate_manifest
|
import generate_manifest
|
||||||
|
|
||||||
yellow = '\033[93m'
|
red = '\033[91m'
|
||||||
green = '\033[92m'
|
green = '\033[92m'
|
||||||
end_format = '\033[0m'
|
end_format = '\033[0m'
|
||||||
bold = '\033[1m'
|
bold = '\033[1m'
|
||||||
|
@ -28,6 +28,8 @@ the Python version this command is executed with."""
|
||||||
metavar='PATH_TO_PYTHON_INTERPRETER',
|
metavar='PATH_TO_PYTHON_INTERPRETER',
|
||||||
default=os.path.abspath(sys.executable),
|
default=os.path.abspath(sys.executable),
|
||||||
help='Path to the Python interpreter to use when provisioning.')
|
help='Path to the Python interpreter to use when provisioning.')
|
||||||
|
parser.add_argument('--force', '-f', action='store_true',
|
||||||
|
help='create venv even with outdated Python version.')
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
base_dir = os.path.abspath(os.path.join(__file__, '..', '..'))
|
base_dir = os.path.abspath(os.path.join(__file__, '..', '..'))
|
||||||
|
@ -86,8 +88,11 @@ the Python version this command is executed with."""
|
||||||
install_dependencies('requirements.txt')
|
install_dependencies('requirements.txt')
|
||||||
if py_version > (3, 1):
|
if py_version > (3, 1):
|
||||||
install_dependencies('py3_requirements.txt')
|
install_dependencies('py3_requirements.txt')
|
||||||
else:
|
elif not options.force:
|
||||||
print(yellow + "Your Python version does not support mypy. `tools/run-mypy` will fail." + end_format)
|
print(red + "Provision failed: Cannot create venv with outdated Python version ({}).\n"
|
||||||
|
"Run this script with --force if you want to proceed anyway."
|
||||||
|
.format(py_version_output.strip()) + end_format)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
print(green + 'Success!' + end_format)
|
print(green + 'Success!' + end_format)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue