diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2021-04-25 18:05:55 -0400 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2021-04-25 18:05:55 -0400 |
commit | b720937d0af9e8382c8b9e00b2c0d5715b7cfbe5 (patch) | |
tree | c29ce9e7423c4f89e79634991941e5bdf9d07a15 /tools | |
parent | 8b494633df0f6770946092498aed76fd30be99b1 (diff) | |
parent | b5fa6ad11e1344648b470ff0d847a7d940b4c99d (diff) | |
download | python-setuptools-git-feature/distutils-docs.tar.gz |
Merge branch 'main' into feature/distutils-docsfeature/distutils-docs
Diffstat (limited to 'tools')
-rw-r--r-- | tools/tox_pip.py | 70 |
1 files changed, 0 insertions, 70 deletions
diff --git a/tools/tox_pip.py b/tools/tox_pip.py deleted file mode 100644 index be2ff1d0..00000000 --- a/tools/tox_pip.py +++ /dev/null @@ -1,70 +0,0 @@ -import os -import subprocess -import sys -import re - - -def remove_setuptools(): - """ - Remove setuptools from the current environment. - """ - print("Removing setuptools") - cmd = [sys.executable, '-m', 'pip', 'uninstall', '-y', 'setuptools'] - # set cwd to something other than '.' to avoid detecting - # '.' as the installed package. - subprocess.check_call(cmd, cwd=os.environ['TOX_WORK_DIR']) - - -def bootstrap(): - print("Running bootstrap") - cmd = [sys.executable, '-m', '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): - cmd = [sys.executable, '-m', 'pip'] + list(args) - return subprocess.check_call(cmd) - - -def test_dependencies(): - from ConfigParser import ConfigParser - - def clean(dep): - spec, _, _ = dep.partition('#') - return spec.strip() - - parser = ConfigParser() - parser.read('setup.cfg') - raw = parser.get('options.extras_require', 'tests').split('\n') - return filter(None, map(clean, raw)) - - -def run(args): - os.environ['PIP_USE_PEP517'] = 'true' - - if is_install_self(args): - remove_setuptools() - bootstrap() - - pip(*args) - - -if __name__ == '__main__': - run(sys.argv[1:]) |