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

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