Blame SOURCES/allow-stripping-given-prefix-from-wheel-RECORD-files.patch

372d73
diff -up pip-9.0.1/pip/commands/install.py.orig pip-9.0.1/pip/commands/install.py
372d73
--- pip-9.0.1/pip/commands/install.py.orig	2016-11-06 11:49:45.000000000 -0700
372d73
+++ pip-9.0.1/pip/commands/install.py	2016-11-16 16:20:48.638906543 -0700
372d73
@@ -151,6 +151,14 @@ class InstallCommand(RequirementCommand)
372d73
                  "directory.")
372d73
 
372d73
         cmd_opts.add_option(
372d73
+            '--strip-file-prefix',
372d73
+            dest='strip_file_prefix',
372d73
+            metavar='prefix',
372d73
+            default=None,
372d73
+            help="Strip given prefix from script paths in wheel RECORD."
372d73
+        )
372d73
+
372d73
+        cmd_opts.add_option(
372d73
             '--prefix',
372d73
             dest='prefix_path',
372d73
             metavar='dir',
372d73
@@ -340,6 +348,7 @@ class InstallCommand(RequirementCommand)
372d73
                             global_options,
372d73
                             root=options.root_path,
372d73
                             prefix=options.prefix_path,
372d73
+                            strip_file_prefix=options.strip_file_prefix,
372d73
                         )
372d73
 
372d73
                         possible_lib_locations = get_lib_location_guesses(
372d73
diff -up pip-9.0.1/pip/req/req_install.py.orig pip-9.0.1/pip/req/req_install.py
372d73
--- pip-9.0.1/pip/req/req_install.py.orig	2016-11-06 11:49:45.000000000 -0700
372d73
+++ pip-9.0.1/pip/req/req_install.py	2016-11-16 16:19:24.848336960 -0700
372d73
@@ -838,8 +838,7 @@ class InstallRequirement(object):
372d73
         else:
372d73
             return True
372d73
 
372d73
-    def install(self, install_options, global_options=[], root=None,
372d73
-                prefix=None):
372d73
+    def install(self, install_options, global_options=[], root=None, prefix=None, strip_file_prefix=None):
372d73
         if self.editable:
372d73
             self.install_editable(
372d73
                 install_options, global_options, prefix=prefix)
372d73
@@ -848,7 +847,12 @@ class InstallRequirement(object):
372d73
             version = pip.wheel.wheel_version(self.source_dir)
372d73
             pip.wheel.check_compatibility(version, self.name)
372d73
 
372d73
-            self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
372d73
+            self.move_wheel_files(
372d73
+                self.source_dir,
372d73
+                root=root,
372d73
+                prefix=prefix,
372d73
+                strip_file_prefix=strip_file_prefix
372d73
+            )
372d73
             self.install_succeeded = True
372d73
             return
372d73
 
372d73
@@ -1053,7 +1057,7 @@ class InstallRequirement(object):
372d73
     def is_wheel(self):
372d73
         return self.link and self.link.is_wheel
372d73
 
372d73
-    def move_wheel_files(self, wheeldir, root=None, prefix=None):
372d73
+    def move_wheel_files(self, wheeldir, root=None, prefix=None, strip_file_prefix=None):
372d73
         move_wheel_files(
372d73
             self.name, self.req, wheeldir,
372d73
             user=self.use_user_site,
372d73
@@ -1062,6 +1066,7 @@ class InstallRequirement(object):
372d73
             prefix=prefix,
372d73
             pycompile=self.pycompile,
372d73
             isolated=self.isolated,
372d73
+            strip_file_prefix=strip_file_prefix,
372d73
         )
372d73
 
372d73
     def get_dist(self):
372d73
diff -up pip-9.0.1/pip/wheel.py.orig pip-9.0.1/pip/wheel.py
372d73
--- pip-9.0.1/pip/wheel.py.orig	2016-11-06 11:49:45.000000000 -0700
372d73
+++ pip-9.0.1/pip/wheel.py	2016-11-16 16:19:24.848336960 -0700
372d73
@@ -238,7 +238,7 @@ def get_entrypoints(filename):
372d73
 
372d73
 
372d73
 def move_wheel_files(name, req, wheeldir, user=False, home=None, root=None,
372d73
-                     pycompile=True, scheme=None, isolated=False, prefix=None):
372d73
+                     pycompile=True, scheme=None, isolated=False, prefix=None, strip_file_prefix=None):
372d73
     """Install a wheel"""
372d73
 
372d73
     if not scheme:
372d73
@@ -521,7 +521,11 @@ if __name__ == '__main__':
372d73
                 writer.writerow(row)
372d73
             for f in generated:
372d73
                 h, l = rehash(f)
372d73
-                writer.writerow((normpath(f, lib_dir), h, l))
372d73
+                final_path = normpath(f, lib_dir)
372d73
+                if strip_file_prefix and final_path.startswith(strip_file_prefix):
372d73
+                    final_path = os.path.join(os.sep,
372d73
+                            os.path.relpath(final_path, strip_file_prefix))
372d73
+                writer.writerow((final_path, h, l))
372d73
             for f in installed:
372d73
                 writer.writerow((installed[f], '', ''))
372d73
     shutil.move(temp_record, record)