|
|
684680 |
From 7b3991c99cd8bb9358e109901d4aa8f51269a87a Mon Sep 17 00:00:00 2001
|
|
|
684680 |
From: Tomas Orsava <tomas.n@orsava.cz>
|
|
|
684680 |
Date: Tue, 17 May 2016 16:40:37 +0200
|
|
|
684680 |
Subject: [PATCH] Allow stripping given prefix from wheel RECORD files
|
|
|
7a22a9 |
|
|
|
684680 |
Update of a previous patch [0] by Slavek Kabrda <bkabrda@redhat.com>.
|
|
|
684680 |
Changes in the pip/wheel.py file in upstream prevented #2 hunk from being
|
|
|
684680 |
applied cleanly.
|
|
|
684680 |
|
|
|
684680 |
[0] pip-1.5rc1-allow-stripping-prefix-from-wheel-RECORD-files.patch
|
|
|
684680 |
---
|
|
|
684680 |
pip/commands/install.py | 9 +++++++++
|
|
|
684680 |
pip/req/req_install.py | 13 +++++++++----
|
|
|
684680 |
pip/wheel.py | 8 ++++++--
|
|
|
684680 |
3 files changed, 24 insertions(+), 6 deletions(-)
|
|
|
7a22a9 |
|
|
|
7a22a9 |
diff --git a/pip/commands/install.py b/pip/commands/install.py
|
|
|
684680 |
index 7ddde93..e31bd3e 100644
|
|
|
7a22a9 |
--- a/pip/commands/install.py
|
|
|
7a22a9 |
+++ b/pip/commands/install.py
|
|
|
684680 |
@@ -137,6 +137,14 @@ class InstallCommand(RequirementCommand):
|
|
|
265074 |
"directory.")
|
|
|
7a22a9 |
|
|
|
7a22a9 |
cmd_opts.add_option(
|
|
|
7a22a9 |
+ '--strip-file-prefix',
|
|
|
7a22a9 |
+ dest='strip_file_prefix',
|
|
|
7a22a9 |
+ metavar='prefix',
|
|
|
7a22a9 |
+ default=None,
|
|
|
7a22a9 |
+ help="Strip given prefix from script paths in wheel RECORD."
|
|
|
7a22a9 |
+ )
|
|
|
7a22a9 |
+
|
|
|
7a22a9 |
+ cmd_opts.add_option(
|
|
|
684680 |
'--prefix',
|
|
|
684680 |
dest='prefix_path',
|
|
|
684680 |
metavar='dir',
|
|
|
684680 |
@@ -315,6 +323,7 @@ class InstallCommand(RequirementCommand):
|
|
|
265074 |
global_options,
|
|
|
265074 |
root=options.root_path,
|
|
|
684680 |
prefix=options.prefix_path,
|
|
|
265074 |
+ strip_file_prefix=options.strip_file_prefix,
|
|
|
265074 |
)
|
|
|
265074 |
reqs = sorted(
|
|
|
265074 |
requirement_set.successfully_installed,
|
|
|
265074 |
diff --git a/pip/req/req_install.py b/pip/req/req_install.py
|
|
|
684680 |
index 9e9fbbb..47f263f 100644
|
|
|
265074 |
--- a/pip/req/req_install.py
|
|
|
265074 |
+++ b/pip/req/req_install.py
|
|
|
684680 |
@@ -818,8 +818,7 @@ class InstallRequirement(object):
|
|
|
265074 |
else:
|
|
|
265074 |
return True
|
|
|
7a22a9 |
|
|
|
684680 |
- def install(self, install_options, global_options=[], root=None,
|
|
|
684680 |
- prefix=None):
|
|
|
684680 |
+ def install(self, install_options, global_options=[], root=None, prefix=None, strip_file_prefix=None):
|
|
|
7a22a9 |
if self.editable:
|
|
|
684680 |
self.install_editable(
|
|
|
684680 |
install_options, global_options, prefix=prefix)
|
|
|
684680 |
@@ -828,7 +827,12 @@ class InstallRequirement(object):
|
|
|
7a22a9 |
version = pip.wheel.wheel_version(self.source_dir)
|
|
|
7a22a9 |
pip.wheel.check_compatibility(version, self.name)
|
|
|
7a22a9 |
|
|
|
684680 |
- self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
|
|
|
7a22a9 |
+ self.move_wheel_files(
|
|
|
7a22a9 |
+ self.source_dir,
|
|
|
7a22a9 |
+ root=root,
|
|
|
684680 |
+ prefix=prefix,
|
|
|
7a22a9 |
+ strip_file_prefix=strip_file_prefix
|
|
|
7a22a9 |
+ )
|
|
|
7a22a9 |
self.install_succeeded = True
|
|
|
7a22a9 |
return
|
|
|
7a22a9 |
|
|
|
684680 |
@@ -1021,7 +1025,7 @@ class InstallRequirement(object):
|
|
|
265074 |
def is_wheel(self):
|
|
|
265074 |
return self.link and self.link.is_wheel
|
|
|
7a22a9 |
|
|
|
684680 |
- def move_wheel_files(self, wheeldir, root=None, prefix=None):
|
|
|
684680 |
+ def move_wheel_files(self, wheeldir, root=None, prefix=None, strip_file_prefix=None):
|
|
|
7a22a9 |
move_wheel_files(
|
|
|
7a22a9 |
self.name, self.req, wheeldir,
|
|
|
7a22a9 |
user=self.use_user_site,
|
|
|
684680 |
@@ -1030,6 +1034,7 @@ class InstallRequirement(object):
|
|
|
684680 |
prefix=prefix,
|
|
|
7a22a9 |
pycompile=self.pycompile,
|
|
|
265074 |
isolated=self.isolated,
|
|
|
7a22a9 |
+ strip_file_prefix=strip_file_prefix,
|
|
|
7a22a9 |
)
|
|
|
7a22a9 |
|
|
|
265074 |
def get_dist(self):
|
|
|
7a22a9 |
diff --git a/pip/wheel.py b/pip/wheel.py
|
|
|
684680 |
index b257d76..6d78ce6 100644
|
|
|
7a22a9 |
--- a/pip/wheel.py
|
|
|
7a22a9 |
+++ b/pip/wheel.py
|
|
|
684680 |
@@ -238,7 +238,7 @@ def get_entrypoints(filename):
|
|
|
7a22a9 |
|
|
|
7a22a9 |
|
|
|
7a22a9 |
def move_wheel_files(name, req, wheeldir, user=False, home=None, root=None,
|
|
|
684680 |
- pycompile=True, scheme=None, isolated=False, prefix=None):
|
|
|
684680 |
+ pycompile=True, scheme=None, isolated=False, prefix=None, strip_file_prefix=None):
|
|
|
7a22a9 |
"""Install a wheel"""
|
|
|
7a22a9 |
|
|
|
7a22a9 |
if not scheme:
|
|
|
684680 |
@@ -522,7 +522,11 @@ if __name__ == '__main__':
|
|
|
7a22a9 |
writer.writerow(row)
|
|
|
7a22a9 |
for f in generated:
|
|
|
7a22a9 |
h, l = rehash(f)
|
|
|
684680 |
- writer.writerow((normpath(f, lib_dir), h, l))
|
|
|
684680 |
+ final_path = normpath(f, lib_dir)
|
|
|
684680 |
+ if strip_file_prefix and final_path.startswith(strip_file_prefix):
|
|
|
684680 |
+ final_path = os.path.join(os.sep,
|
|
|
684680 |
+ os.path.relpath(final_path, strip_file_prefix))
|
|
|
684680 |
+ writer.writerow((final_path, h, l))
|
|
|
7a22a9 |
for f in installed:
|
|
|
7a22a9 |
writer.writerow((installed[f], '', ''))
|
|
|
684680 |
shutil.move(temp_record, record)
|
|
|
684680 |
--
|
|
|
684680 |
2.5.5
|
|
|
684680 |
|