mirror of https://github.com/pypa/pip
fix PEP 518 support when pip is installed in the user site
Do not use the build environment isolation during the build dependencies installation.
This commit is contained in:
parent
eaa2d0c846
commit
02b678f557
|
@ -0,0 +1 @@
|
|||
Fix PEP 518 support when pip is installed in the user site.
|
|
@ -144,8 +144,10 @@ class IsSDist(DistAbstraction):
|
|||
)
|
||||
|
||||
if should_isolate:
|
||||
with self.req.build_env as prefix:
|
||||
_install_build_reqs(finder, prefix, build_requirements)
|
||||
with self.req.build_env:
|
||||
pass
|
||||
_install_build_reqs(finder, self.req.build_env.path,
|
||||
build_requirements)
|
||||
else:
|
||||
self.req.build_env = NoOpBuildEnvironment(no_clean=False)
|
||||
|
||||
|
|
|
@ -137,20 +137,24 @@ def isolate(tmpdir):
|
|||
)
|
||||
|
||||
|
||||
@pytest.yield_fixture(scope='session')
|
||||
def virtualenv_template(tmpdir_factory):
|
||||
tmpdir = Path(str(tmpdir_factory.mktemp('virtualenv')))
|
||||
# Copy over our source tree so that each virtual environment is self
|
||||
# contained
|
||||
pip_src = tmpdir.join("pip_src").abspath
|
||||
@pytest.fixture(scope='session')
|
||||
def pip_src(tmpdir_factory):
|
||||
pip_src = Path(str(tmpdir_factory.mktemp('pip_src'))).join('pip_src')
|
||||
# Copy over our source tree so that each use is self contained
|
||||
shutil.copytree(
|
||||
SRC_DIR,
|
||||
pip_src,
|
||||
pip_src.abspath,
|
||||
ignore=shutil.ignore_patterns(
|
||||
"*.pyc", "__pycache__", "contrib", "docs", "tasks", "*.txt",
|
||||
"tests", "pip.egg-info", "build", "dist", ".tox", ".git",
|
||||
),
|
||||
)
|
||||
return pip_src
|
||||
|
||||
|
||||
@pytest.yield_fixture(scope='session')
|
||||
def virtualenv_template(tmpdir_factory, pip_src):
|
||||
tmpdir = Path(str(tmpdir_factory.mktemp('virtualenv')))
|
||||
# Create the virtual environment
|
||||
venv = VirtualEnvironment.create(
|
||||
tmpdir.join("venv_orig"),
|
||||
|
|
|
@ -45,6 +45,29 @@ def test_pep518_uses_build_env(script, data, original_setuptools):
|
|||
)
|
||||
|
||||
|
||||
def test_pep518_with_user_pip(script, virtualenv, pip_src, data):
|
||||
virtualenv.system_site_packages = True
|
||||
script.pip("install", "--ignore-installed", "--user", pip_src)
|
||||
system_pip_dir = script.site_packages_path / 'pip'
|
||||
system_pip_dir.rmtree()
|
||||
system_pip_dir.mkdir()
|
||||
with open(system_pip_dir / '__init__.py', 'w') as fp:
|
||||
fp.write('raise ImportError\n')
|
||||
to_install = data.src.join("pep518-3.0")
|
||||
for command in ('install', 'wheel'):
|
||||
kwargs = {}
|
||||
if sys.version_info[:2] == (3, 3):
|
||||
# Ignore Python 3.3 deprecation warning...
|
||||
kwargs['expect_stderr'] = True
|
||||
script.run(
|
||||
"python", "-c",
|
||||
"import pip._internal; pip._internal.main(["
|
||||
"%r, " "'-f', %r, " "%r, "
|
||||
"])" % (command, str(data.packages), str(to_install)),
|
||||
**kwargs
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.network
|
||||
def test_pip_second_command_line_interface_works(script, data):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue