mirror of https://github.com/pypa/pip
Support also pip install -e --prefix
This commit is contained in:
parent
7270d272f4
commit
b4bb2eee14
|
@ -795,7 +795,8 @@ exec(compile(
|
|||
def install(self, install_options, global_options=[], root=None,
|
||||
prefix=None):
|
||||
if self.editable:
|
||||
self.install_editable(install_options, global_options)
|
||||
self.install_editable(
|
||||
install_options, global_options, prefix=prefix)
|
||||
return
|
||||
if self.is_wheel:
|
||||
version = pip.wheel.wheel_version(self.source_dir)
|
||||
|
@ -929,12 +930,17 @@ exec(compile(
|
|||
rmtree(self._temp_build_dir)
|
||||
self._temp_build_dir = None
|
||||
|
||||
def install_editable(self, install_options, global_options=()):
|
||||
def install_editable(self, install_options,
|
||||
global_options=(), prefix=None):
|
||||
logger.info('Running setup.py develop for %s', self.name)
|
||||
|
||||
if self.isolated:
|
||||
global_options = list(global_options) + ["--no-user-cfg"]
|
||||
|
||||
if prefix:
|
||||
prefix_param = ['--prefix={0}'.format(prefix)]
|
||||
install_options = list(install_options) + prefix_param
|
||||
|
||||
with indent_log():
|
||||
# FIXME: should we do --install-headers here too?
|
||||
cwd = self.source_dir
|
||||
|
|
|
@ -494,7 +494,7 @@ def test_install_package_with_prefix(script, data):
|
|||
prefix_path = script.scratch_path / 'prefix'
|
||||
result = script.pip(
|
||||
'install', '--prefix', prefix_path, '-f', data.find_links,
|
||||
'--no-index', 'simple==1.0',
|
||||
'--no-binary', 'simple', '--no-index', 'simple==1.0',
|
||||
)
|
||||
|
||||
if hasattr(sys, "pypy_version_info"):
|
||||
|
@ -507,6 +507,34 @@ def test_install_package_with_prefix(script, data):
|
|||
assert install_path in result.files_created, str(result)
|
||||
|
||||
|
||||
def test_install_editable_with_prefix(script):
|
||||
# make a dummy project
|
||||
pkga_path = script.scratch_path / 'pkga'
|
||||
pkga_path.mkdir()
|
||||
pkga_path.join("setup.py").write(textwrap.dedent("""
|
||||
from setuptools import setup
|
||||
setup(name='pkga',
|
||||
version='0.1')
|
||||
"""))
|
||||
|
||||
site_packages = os.path.join(
|
||||
'prefix', 'lib', 'python{0}'.format(pyversion), 'site-packages')
|
||||
|
||||
# make sure target path is in PYTHONPATH
|
||||
pythonpath = script.scratch_path / site_packages
|
||||
pythonpath.makedirs()
|
||||
script.environ["PYTHONPATH"] = pythonpath
|
||||
|
||||
# install pkga package into the absolute prefix directory
|
||||
prefix_path = script.scratch_path / 'prefix'
|
||||
result = script.pip(
|
||||
'install', '--editable', pkga_path, '--prefix', prefix_path)
|
||||
|
||||
# assert pkga is installed at correct location
|
||||
install_path = script.scratch / site_packages / 'pkga.egg-link'
|
||||
assert install_path in result.files_created, str(result)
|
||||
|
||||
|
||||
def test_install_package_conflict_prefix_and_user(script, data):
|
||||
"""
|
||||
Test installing a package using pip install --prefix --user errors out
|
||||
|
|
Loading…
Reference in New Issue