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

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