buildPythonPackage: fix --prefix also for pip install -e
This commit is contained in:
parent
d2519c1f16
commit
fc611fe634
@ -117,3 +117,35 @@ index 403f48b..14eb141 100644
|
|||||||
)
|
)
|
||||||
|
|
||||||
if root_is_purelib(name, wheeldir):
|
if root_is_purelib(name, wheeldir):
|
||||||
|
diff --git a/pip/req/req_install.py b/pip/req/req_install.py
|
||||||
|
index 51bf4a7..e2e285e 100644
|
||||||
|
--- a/pip/req/req_install.py
|
||||||
|
+++ b/pip/req/req_install.py
|
||||||
|
@@ -795,7 +795,7 @@ 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 +929,16 @@ 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
|
||||||
|
|
||||||
|
@ -1,115 +0,0 @@
|
|||||||
diff --git a/pip/commands/install.py b/pip/commands/install.py
|
|
||||||
index ddaa470..b798433 100644
|
|
||||||
--- a/pip/commands/install.py
|
|
||||||
+++ b/pip/commands/install.py
|
|
||||||
@@ -147,6 +147,13 @@ class InstallCommand(Command):
|
|
||||||
"directory.")
|
|
||||||
|
|
||||||
cmd_opts.add_option(
|
|
||||||
+ '--prefix',
|
|
||||||
+ dest='prefix_path',
|
|
||||||
+ metavar='dir',
|
|
||||||
+ default=None,
|
|
||||||
+ help="Installation prefix where lib, bin and other top-level folders are placed")
|
|
||||||
+
|
|
||||||
+ cmd_opts.add_option(
|
|
||||||
"--compile",
|
|
||||||
action="store_true",
|
|
||||||
dest="compile",
|
|
||||||
@@ -350,6 +357,7 @@ class InstallCommand(Command):
|
|
||||||
install_options,
|
|
||||||
global_options,
|
|
||||||
root=options.root_path,
|
|
||||||
+ prefix=options.prefix_path,
|
|
||||||
)
|
|
||||||
reqs = sorted(
|
|
||||||
requirement_set.successfully_installed,
|
|
||||||
diff --git a/pip/locations.py b/pip/locations.py
|
|
||||||
index dfbc6da..b2f3383 100644
|
|
||||||
--- a/pip/locations.py
|
|
||||||
+++ b/pip/locations.py
|
|
||||||
@@ -209,7 +209,7 @@ site_config_files = [
|
|
||||||
|
|
||||||
|
|
||||||
def distutils_scheme(dist_name, user=False, home=None, root=None,
|
|
||||||
- isolated=False):
|
|
||||||
+ isolated=False, prefix=None):
|
|
||||||
"""
|
|
||||||
Return a distutils install scheme
|
|
||||||
"""
|
|
||||||
@@ -231,6 +231,10 @@ def distutils_scheme(dist_name, user=False, home=None, root=None,
|
|
||||||
# or user base for installations during finalize_options()
|
|
||||||
# ideally, we'd prefer a scheme class that has no side-effects.
|
|
||||||
i.user = user or i.user
|
|
||||||
+ if user:
|
|
||||||
+ i.prefix = ""
|
|
||||||
+ else:
|
|
||||||
+ i.prefix = prefix or i.prefix
|
|
||||||
i.home = home or i.home
|
|
||||||
i.root = root or i.root
|
|
||||||
i.finalize_options()
|
|
||||||
diff --git a/pip/req/req_install.py b/pip/req/req_install.py
|
|
||||||
index 38013c5..14b868b 100644
|
|
||||||
--- a/pip/req/req_install.py
|
|
||||||
+++ b/pip/req/req_install.py
|
|
||||||
@@ -806,7 +806,7 @@ exec(compile(
|
|
||||||
else:
|
|
||||||
return True
|
|
||||||
|
|
||||||
- def install(self, install_options, global_options=(), root=None):
|
|
||||||
+ def install(self, install_options, global_options=[], root=None, prefix=None):
|
|
||||||
if self.editable:
|
|
||||||
self.install_editable(install_options, global_options)
|
|
||||||
return
|
|
||||||
@@ -814,7 +814,7 @@ exec(compile(
|
|
||||||
version = pip.wheel.wheel_version(self.source_dir)
|
|
||||||
pip.wheel.check_compatibility(version, self.name)
|
|
||||||
|
|
||||||
- self.move_wheel_files(self.source_dir, root=root)
|
|
||||||
+ self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
|
|
||||||
self.install_succeeded = True
|
|
||||||
return
|
|
||||||
|
|
||||||
@@ -839,6 +839,8 @@ exec(compile(
|
|
||||||
|
|
||||||
if root is not None:
|
|
||||||
install_args += ['--root', root]
|
|
||||||
+ if prefix is not None:
|
|
||||||
+ install_args += ['--prefix', prefix]
|
|
||||||
|
|
||||||
if self.pycompile:
|
|
||||||
install_args += ["--compile"]
|
|
||||||
@@ -1008,12 +1010,13 @@ exec(compile(
|
|
||||||
def is_wheel(self):
|
|
||||||
return self.link and self.link.is_wheel
|
|
||||||
|
|
||||||
- def move_wheel_files(self, wheeldir, root=None):
|
|
||||||
+ def move_wheel_files(self, wheeldir, root=None, prefix=None):
|
|
||||||
move_wheel_files(
|
|
||||||
self.name, self.req, wheeldir,
|
|
||||||
user=self.use_user_site,
|
|
||||||
home=self.target_dir,
|
|
||||||
root=root,
|
|
||||||
+ prefix=prefix,
|
|
||||||
pycompile=self.pycompile,
|
|
||||||
isolated=self.isolated,
|
|
||||||
)
|
|
||||||
diff --git a/pip/wheel.py b/pip/wheel.py
|
|
||||||
index 57246ca..738a6b0 100644
|
|
||||||
--- a/pip/wheel.py
|
|
||||||
+++ b/pip/wheel.py
|
|
||||||
@@ -130,12 +130,12 @@ def get_entrypoints(filename):
|
|
||||||
|
|
||||||
|
|
||||||
def move_wheel_files(name, req, wheeldir, user=False, home=None, root=None,
|
|
||||||
- pycompile=True, scheme=None, isolated=False):
|
|
||||||
+ pycompile=True, scheme=None, isolated=False, prefix=None):
|
|
||||||
"""Install a wheel"""
|
|
||||||
|
|
||||||
if not scheme:
|
|
||||||
scheme = distutils_scheme(
|
|
||||||
- name, user=user, home=home, root=root, isolated=isolated
|
|
||||||
+ name, user=user, home=home, root=root, isolated=isolated, prefix=prefix,
|
|
||||||
)
|
|
||||||
|
|
||||||
if root_is_purelib(name, wheeldir):
|
|
Loading…
Reference in New Issue
Block a user