Skip to content

Commit

Permalink
Extract pip wrapper launcher. Ref #1644.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Jan 26, 2019
1 parent f8b9c42 commit 3e23fa7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
18 changes: 18 additions & 0 deletions pip-wrapper.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"""
Wrap the pip command to:
- Avoid the default 'python -m pip' invocation, which causes the current
working directory to be added to the path, which causes problems.
"""


import sys
import subprocess


def main():
cmd = sys.argv[1:]
subprocess.check_call(cmd)


__name__ == '__main__' and main()
8 changes: 2 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@ envlist=python

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

0 comments on commit 3e23fa7

Please sign in to comment.