diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2020-01-19 14:06:35 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2020-01-19 15:05:26 -0500 |
commit | 6d4e23882a5b1e1f31fb452aaad9d19cf0d02604 (patch) | |
tree | 571fa87a7dab690a86fc611a716e433d279d21ff /tools/tox_pip.py | |
parent | 7cd8b4966a6e7186ff45fe1f1c09a58f8a678113 (diff) | |
download | external_python_setuptools-6d4e23882a5b1e1f31fb452aaad9d19cf0d02604.tar.gz external_python_setuptools-6d4e23882a5b1e1f31fb452aaad9d19cf0d02604.tar.bz2 external_python_setuptools-6d4e23882a5b1e1f31fb452aaad9d19cf0d02604.zip |
Move test dependencies to package metadata.
Diffstat (limited to 'tools/tox_pip.py')
-rw-r--r-- | tools/tox_pip.py | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/tools/tox_pip.py b/tools/tox_pip.py index 2d33e9e5..1b7eeda5 100644 --- a/tools/tox_pip.py +++ b/tools/tox_pip.py @@ -1,6 +1,7 @@ import os import subprocess import sys +import re def remove_setuptools(): @@ -20,12 +21,29 @@ def bootstrap(): subprocess.check_call(cmd) +def is_install_self(args): + """ + Do the args represent an install of .? + """ + def strip_extras(arg): + match = re.match(r'(.*)?\[.*\]$', arg) + return match.group(1) if match else arg + + return ( + 'install' in args + and any( + arg in ['.', os.getcwd()] + for arg in map(strip_extras, args) + ) + ) + + def pip(args): # Honor requires-python when installing test suite dependencies if any('-r' in arg for arg in args): os.environ['PIP_IGNORE_REQUIRES_PYTHON'] = '0' - if '.' in args: + if is_install_self(args): remove_setuptools() bootstrap() |