diff --git a/tools/provision b/tools/provision index 0f5218f..66349d8 100755 --- a/tools/provision +++ b/tools/provision @@ -40,6 +40,12 @@ the Python version this command is executed with.""" py_version = tuple(int(num) for num in py_version_list) venv_name = 'zulip-api-py{}-venv'.format(py_version[0]) + if py_version <= (3, 1) and (not options.force): + 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) + venv_dir = os.path.join(base_dir, venv_name) if not os.path.isdir(venv_dir): try: @@ -88,11 +94,6 @@ the Python version this command is executed with.""" install_dependencies('requirements.txt') if py_version > (3, 1): install_dependencies('py3_requirements.txt') - elif not options.force: - 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)