Skip to content

Commit

Permalink
Merge pull request #5841 from benoit-pierre/fix_python_src/pip
Browse files Browse the repository at this point in the history
fix support for invoking pip using `python src/pip ...`
  • Loading branch information
pradyunsg committed Oct 28, 2018
2 parents d490f75 + 464b2f3 commit b47b2fa
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/5841.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix support for invoking pip using `python src/pip ...`.
6 changes: 4 additions & 2 deletions src/pip/_internal/build_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from pip._vendor.pkg_resources import Requirement, VersionConflict, WorkingSet

from pip import __file__ as pip_location
from pip._internal.utils.misc import call_subprocess
from pip._internal.utils.temp_dir import TempDirectory
from pip._internal.utils.ui import open_spinner
Expand Down Expand Up @@ -103,8 +104,9 @@ def missing_requirements(self, reqs):

def install_requirements(self, finder, requirements, message):
args = [
sys.executable, '-m', 'pip', 'install', '--ignore-installed',
'--no-user', '--prefix', self.path, '--no-warn-script-location',
sys.executable, os.path.dirname(pip_location), 'install',
'--ignore-installed', '--no-user', '--prefix', self.path,
'--no-warn-script-location',
]
if logger.getEffectiveLevel() <= logging.DEBUG:
args.append('-v')
Expand Down
13 changes: 13 additions & 0 deletions tests/functional/test_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,19 @@ def test_pep518_uses_build_env(script, data, common_wheels, command, variant):
)


def test_pep518_build_env_uses_same_pip(script, data, pip_src, common_wheels):
"""Ensure the subprocess call to pip for installing the
build dependencies is using the same version of pip.
"""
with open(script.scratch_path / 'pip.py', 'w') as fp:
fp.write('raise ImportError')
script.run(
'python', pip_src / 'src/pip', 'install', '--no-index',
'-f', common_wheels, '-f', data.packages,
data.src.join("pep518-3.0"),
)


def test_pep518_refuses_invalid_requires(script, data, common_wheels):
result = script.pip(
'install', '-f', common_wheels,
Expand Down

0 comments on commit b47b2fa

Please sign in to comment.