Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix support for invoking pip using python src/pip ... #5841

Merged
merged 1 commit into from
Oct 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix support for invoking pip using python src/pip ...
Ensure the subprocess call to pip for installing the PEP 518
build dependencies is using the same version of pip.
  • Loading branch information
benoit-pierre committed Oct 2, 2018
commit 464b2f30a8eccb7c28287a25ca699a4ce8887984
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 @@ -9,6 +9,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 @@ -93,8 +94,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',
benoit-pierre marked this conversation as resolved.
Show resolved Hide resolved
benoit-pierre marked this conversation as resolved.
Show resolved Hide resolved
'--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 @@ -38,6 +38,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