Sophie

Sophie

distrib > Mageia > 7 > i586 > media > core-updates-src > by-pkgid > eb62fb6fe1ba344916f947b1825ba785 > files > 2

python-pip-19.0.3-1.3.mga7.src.rpm

diff -Naur -x '*.orig' pip-19.0.3/src/pip/_internal/commands/install.py pip-19.0.3-allow-stripping-given-prefix-from-wheel-RECORD-files/src/pip/_internal/commands/install.py
--- pip-19.0.3/src/pip/_internal/commands/install.py	2019-02-18 13:43:43.000000000 +0100
+++ pip-19.0.3-allow-stripping-given-prefix-from-wheel-RECORD-files/src/pip/_internal/commands/install.py	2019-03-05 19:57:30.306541876 +0100
@@ -109,6 +109,14 @@
             default=None,
             help="Installation prefix where lib, bin and other top-level "
                  "folders are placed")
+        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(cmdoptions.build_dir())
 
@@ -391,6 +399,7 @@
                         pycompile=options.compile,
                         warn_script_location=warn_script_location,
                         use_user_site=options.use_user_site,
+                        strip_file_prefix=options.strip_file_prefix,
                     )
 
                     lib_locations = get_lib_location_guesses(
diff -Naur -x '*.orig' pip-19.0.3/src/pip/_internal/req/req_install.py pip-19.0.3-allow-stripping-given-prefix-from-wheel-RECORD-files/src/pip/_internal/req/req_install.py
--- pip-19.0.3/src/pip/_internal/req/req_install.py	2019-02-18 13:43:43.000000000 +0100
+++ pip-19.0.3-allow-stripping-given-prefix-from-wheel-RECORD-files/src/pip/_internal/req/req_install.py	2019-03-05 19:57:30.306541876 +0100
@@ -431,7 +431,8 @@
         prefix=None,  # type: Optional[str]
         warn_script_location=True,  # type: bool
         use_user_site=False,  # type: bool
-        pycompile=True  # type: bool
+        pycompile=True,  # type: bool
+        strip_file_prefix=None  # type: Optional[str]
     ):
         # type: (...) -> None
         move_wheel_files(
@@ -443,6 +444,7 @@
             pycompile=pycompile,
             isolated=self.isolated,
             warn_script_location=warn_script_location,
+            strip_file_prefix=strip_file_prefix,
         )
 
     # Things valid for sdists
@@ -894,7 +896,8 @@
         prefix=None,  # type: Optional[str]
         warn_script_location=True,  # type: bool
         use_user_site=False,  # type: bool
-        pycompile=True  # type: bool
+        pycompile=True,  # type: bool
+        strip_file_prefix=None  # type: Optional[str]
     ):
         # type: (...) -> None
         global_options = global_options if global_options is not None else []
@@ -911,6 +914,7 @@
                 self.source_dir, root=root, prefix=prefix, home=home,
                 warn_script_location=warn_script_location,
                 use_user_site=use_user_site, pycompile=pycompile,
+                strip_file_prefix=strip_file_prefix,
             )
             self.install_succeeded = True
             return
diff -Naur -x '*.orig' pip-19.0.3/src/pip/_internal/wheel.py pip-19.0.3-allow-stripping-given-prefix-from-wheel-RECORD-files/src/pip/_internal/wheel.py
--- pip-19.0.3/src/pip/_internal/wheel.py	2019-02-20 18:00:55.000000000 +0100
+++ pip-19.0.3-allow-stripping-given-prefix-from-wheel-RECORD-files/src/pip/_internal/wheel.py	2019-03-05 19:57:30.307541870 +0100
@@ -265,6 +265,7 @@
     changed,  # type: set
     generated,  # type: List[str]
     lib_dir,  # type: str
+    strip_file_prefix=None,  # type: Optional[str]
 ):
     # type: (...) -> List[InstalledCSVRow]
     """
@@ -289,7 +290,11 @@
         installed_rows.append(tuple(row))
     for f in generated:
         digest, length = rehash(f)
-        installed_rows.append((normpath(f, lib_dir), digest, str(length)))
+        final_path = normpath(f, lib_dir)
+        if strip_file_prefix and final_path.startswith(strip_file_prefix):
+            final_path = os.path.join(os.sep,
+                    os.path.relpath(final_path, strip_file_prefix))
+        installed_rows.append((final_path, digest, str(length)))
     for f in installed:
         installed_rows.append((installed[f], '', ''))
     return installed_rows
@@ -306,7 +311,8 @@
     scheme=None,  # type: Optional[Mapping[str, str]]
     isolated=False,  # type: bool
     prefix=None,  # type: Optional[str]
-    warn_script_location=True  # type: bool
+    warn_script_location=True,  # type: bool
+    strip_file_prefix=None  # type: Optional[str]
 ):
     # type: (...) -> None
     """Install a wheel"""
@@ -605,6 +611,7 @@
             outrows = get_csv_rows_for_installed(
                 reader, installed=installed, changed=changed,
                 generated=generated, lib_dir=lib_dir,
+                strip_file_prefix=strip_file_prefix
             )
             writer = csv.writer(record_out)
             # Sort to simplify testing.