diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 80fa14bb..a2ce1761 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,7 +11,7 @@ repos: - id: name-tests-test - id: requirements-txt-fixer - id: double-quote-string-fixer -- repo: https://gitlab.com/pycqa/flake8 +- repo: https://gitlab.com/pycqa/flake8.git rev: 3.8.4 hooks: - id: flake8 diff --git a/pre_commit/languages/python.py b/pre_commit/languages/python.py index 65f521cd..da528150 100644 --- a/pre_commit/languages/python.py +++ b/pre_commit/languages/python.py @@ -197,10 +197,17 @@ def install_environment( if python is not None: venv_cmd.extend(('-p', python)) install_cmd = ('python', '-mpip', 'install', '.', *additional_dependencies) + setup_dependencies_env = os.environ.get('PYTHON_SETUP_DEPENDENCIES') + if setup_dependencies_env: + setup_dependencies = setup_dependencies_env.split(':') + else: + setup_dependencies = [] with clean_path_on_failure(envdir): cmd_output_b(*venv_cmd, cwd='/') with in_env(prefix, version): + for dep in setup_dependencies: + cmd_output_b('python', '-mpip', 'install', dep) helpers.run_setup_cmd(prefix, install_cmd)