Skip to content

Commit 3e23fa7

Browse files
committed
Extract pip wrapper launcher. Ref #1644.
1 parent f8b9c42 commit 3e23fa7

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed

pip-wrapper.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
"""
2+
Wrap the pip command to:
3+
4+
- Avoid the default 'python -m pip' invocation, which causes the current
5+
working directory to be added to the path, which causes problems.
6+
"""
7+
8+
9+
import sys
10+
import subprocess
11+
12+
13+
def main():
14+
cmd = sys.argv[1:]
15+
subprocess.check_call(cmd)
16+
17+
18+
__name__ == '__main__' and main()

tox.ini

+2-6
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@ envlist=python
99

1010
[testenv]
1111
deps=-rtests/requirements.txt
12-
# Changed from default (`python -m pip ...`)
13-
# to prevent the current working directory
14-
# from being added to `sys.path`.
15-
install_command={envbindir}/pip install {opts} {packages}
16-
# Same as above.
17-
list_dependencies_command={envbindir}/pip freeze
12+
install_command = python ./pip-wrapper.py {envbindir}/pip install {opts} {packages}
13+
list_dependencies_command = python ./pip-wrapper.py {envbindir}/pip freeze
1814
setenv=COVERAGE_FILE={toxworkdir}/.coverage.{envname}
1915
# TODO: The passed environment variables came from copying other tox.ini files
2016
# These should probably be individually annotated to explain what needs them.

0 commit comments

Comments
 (0)