aboutsummaryrefslogtreecommitdiffstats
path: root/tools/tox_pip.py
diff options
context:
space:
mode:
authorBenoit Pierre <benoit.pierre@gmail.com>2019-11-15 19:06:26 +0100
committerBenoit Pierre <benoit.pierre@gmail.com>2019-11-15 19:35:07 +0100
commit77fa2369892b7e45ede9cad18aaa3f0721c96cc3 (patch)
tree1021c1b2051a43abb9a449a547b05c8d5bd9b54b /tools/tox_pip.py
parent55994609aaebecdfb7b8da4945ce0ed799d344c9 (diff)
downloadexternal_python_setuptools-77fa2369892b7e45ede9cad18aaa3f0721c96cc3.tar.gz
external_python_setuptools-77fa2369892b7e45ede9cad18aaa3f0721c96cc3.tar.bz2
external_python_setuptools-77fa2369892b7e45ede9cad18aaa3f0721c96cc3.zip
tweak workaround for #1644
Work around buggy pip detection code for "pip.exe install/update pip ...".
Diffstat (limited to 'tools/tox_pip.py')
-rw-r--r--tools/tox_pip.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/tox_pip.py b/tools/tox_pip.py
index 1117f996..5aeca805 100644
--- a/tools/tox_pip.py
+++ b/tools/tox_pip.py
@@ -17,12 +17,21 @@ def pip(args):
'pip'])
shutil.rmtree(glob(os.path.join(TOX_PIP_DIR, 'pip-*.dist-info'))[0])
# And use that version.
+ pypath = os.environ.get('PYTHONPATH')
+ pypath = pypath.split(os.pathsep) if pypath is not None else []
+ pypath.insert(0, TOX_PIP_DIR)
+ os.environ['PYTHONPATH'] = os.pathsep.join(pypath)
+ # Disable PEP 517 support when using editable installs.
for n, a in enumerate(args):
if not a.startswith('-'):
if a in 'install' and '-e' in args[n:]:
args.insert(n + 1, '--no-use-pep517')
break
- subprocess.check_call([sys.executable, os.path.join(TOX_PIP_DIR, 'pip')] + args)
+ # Fix call for setuptools editable install.
+ for n, a in enumerate(args):
+ if a == '.':
+ args[n] = os.getcwd()
+ subprocess.check_call([sys.executable, '-m', 'pip'] + args, cwd=TOX_PIP_DIR)
if __name__ == '__main__':