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

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