python-pip/pip-1.5rc1-allow-stripping-prefix-from-wheel-RECORD-files.patch

100 lines
3.7 KiB
Diff
Raw Normal View History

commit aefacbb76661520415a1c35028f2984e70cfe0bf
Author: Slavek Kabrda <bkabrda@redhat.com>
Date: Fri Nov 29 13:24:58 2013 +0100
Allow stripping given prefix from wheel RECORD files
diff --git a/pip/commands/install.py b/pip/commands/install.py
index 1693d01..0287c06 100644
--- a/pip/commands/install.py
+++ b/pip/commands/install.py
@@ -137,6 +137,14 @@ class InstallCommand(Command):
2015-01-15 13:05:55 +00:00
"directory.")
cmd_opts.add_option(
+ '--strip-file-prefix',
+ dest='strip_file_prefix',
+ metavar='prefix',
+ default=None,
+ help="Strip given prefix from script paths in wheel RECORD."
+ )
+
+ cmd_opts.add_option(
"--compile",
action="store_true",
dest="compile",
2015-01-15 13:05:55 +00:00
@@ -345,6 +353,7 @@ class InstallCommand(Command):
install_options,
global_options,
root=options.root_path,
+ strip_file_prefix=options.strip_file_prefix,
)
reqs = sorted(
requirement_set.successfully_installed,
diff --git a/pip/req/req_install.py b/pip/req/req_install.py
index 3ae306d..c171130 100644
2015-01-15 13:05:55 +00:00
--- a/pip/req/req_install.py
+++ b/pip/req/req_install.py
@@ -615,15 +615,19 @@ exec(compile(open(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
2015-01-15 13:05:55 +00:00
else:
return True
2015-06-04 09:47:42 +00:00
- def install(self, install_options, global_options=[], root=None):
+ def install(self, install_options, global_options=[], root=None, strip_file_prefix=None):
if self.editable:
self.install_editable(install_options, global_options)
return
if self.is_wheel:
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,
+ strip_file_prefix=strip_file_prefix
+ )
self.install_succeeded = True
return
2015-01-15 13:05:55 +00:00
@@ -844,14 +848,15 @@ exec(compile(open(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
def is_wheel(self):
2015-06-04 09:47:42 +00:00
return self.link and self.link.is_wheel
- def move_wheel_files(self, wheeldir, root=None):
+ def move_wheel_files(self, wheeldir, root=None, strip_file_prefix=None):
move_wheel_files(
self.name, self.req, wheeldir,
user=self.use_user_site,
home=self.target_dir,
root=root,
pycompile=self.pycompile,
2015-01-15 13:05:55 +00:00
isolated=self.isolated,
+ strip_file_prefix=strip_file_prefix,
)
2015-01-15 13:05:55 +00:00
def get_dist(self):
diff --git a/pip/wheel.py b/pip/wheel.py
index fa3e270..3a366d0 100644
--- a/pip/wheel.py
+++ b/pip/wheel.py
@@ -136,7 +136,7 @@ def get_entrypoints(filename):
def move_wheel_files(name, req, wheeldir, user=False, home=None, root=None,
2015-01-15 13:05:55 +00:00
- pycompile=True, scheme=None, isolated=False):
+ pycompile=True, scheme=None, isolated=False, strip_file_prefix=None):
"""Install a wheel"""
2014-05-25 22:10:27 +00:00
if not scheme:
@@ -357,6 +357,8 @@ if __name__ == '__main__':
writer.writerow(row)
for f in generated:
h, l = rehash(f)
+ if strip_file_prefix and f.startswith(strip_file_prefix):
+ f = os.path.join(os.sep, os.path.relpath(f, strip_file_prefix))
writer.writerow((f, h, l))
for f in installed:
writer.writerow((installed[f], '', ''))