From ae9b459f8ec3ff02302f50b7b98fef91054f2a6b Mon Sep 17 00:00:00 2001 From: tianwei Date: Wed, 5 Aug 2020 21:05:03 +0800 Subject: [PATCH 1/3] add strip --- ...given-prefix-from-wheel-RECORD-files.patch | 89 +++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 allow-stripping-given-prefix-from-wheel-RECORD-files.patch diff --git a/allow-stripping-given-prefix-from-wheel-RECORD-files.patch b/allow-stripping-given-prefix-from-wheel-RECORD-files.patch new file mode 100644 index 0000000..00de3c5 --- /dev/null +++ b/allow-stripping-given-prefix-from-wheel-RECORD-files.patch @@ -0,0 +1,89 @@ +diff -ru pip-18.0/src/pip/_internal/commands/install.py pip-18.0_patched/src/pip/_internal/commands/install.py +--- pip-18.0/src/pip/_internal/commands/install.py 2018-07-20 06:10:48.000000000 +0200 ++++ pip-18.0_patched/src/pip/_internal/commands/install.py 2018-07-23 16:49:39.085357813 +0200 +@@ -110,6 +110,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()) + +@@ -345,6 +353,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 -ru pip-18.0/src/pip/_internal/req/req_install.py pip-18.0_patched/src/pip/_internal/req/req_install.py +--- pip-18.0/src/pip/_internal/req/req_install.py 2018-07-22 07:14:20.000000000 +0200 ++++ pip-18.0_patched/src/pip/_internal/req/req_install.py 2018-07-23 16:51:51.115943214 +0200 +@@ -514,7 +514,7 @@ + + def move_wheel_files(self, wheeldir, root=None, home=None, prefix=None, + warn_script_location=True, use_user_site=False, +- pycompile=True): ++ pycompile=True, strip_file_prefix=None): + move_wheel_files( + self.name, self.req, wheeldir, + user=use_user_site, +@@ -524,6 +524,7 @@ + pycompile=pycompile, + isolated=self.isolated, + warn_script_location=warn_script_location, ++ strip_file_prefix=strip_file_prefix, + ) + + # Things valid for sdists +@@ -924,7 +925,7 @@ + + def install(self, install_options, global_options=None, root=None, + home=None, prefix=None, warn_script_location=True, +- use_user_site=False, pycompile=True): ++ use_user_site=False, pycompile=True, strip_file_prefix=None): + global_options = global_options if global_options is not None else [] + if self.editable: + self.install_editable( +@@ -939,6 +940,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 -ru pip-18.0/src/pip/_internal/wheel.py pip-18.0_patched/src/pip/_internal/wheel.py +--- pip-18.0/src/pip/_internal/wheel.py 2018-07-17 10:26:00.000000000 +0200 ++++ pip-18.0_patched/src/pip/_internal/wheel.py 2018-07-23 16:52:57.749238655 +0200 +@@ -206,7 +206,7 @@ + + def move_wheel_files(name, req, wheeldir, user=False, home=None, root=None, + pycompile=True, scheme=None, isolated=False, prefix=None, +- warn_script_location=True): ++ warn_script_location=True, strip_file_prefix=None): + """Install a wheel""" + + if not scheme: +@@ -507,7 +507,12 @@ + writer.writerow(row) + for f in generated: + digest, length = rehash(f) +- writer.writerow((normpath(f, lib_dir), digest, 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)) ++ writer.writerow((final_path, digest, length)) ++ + for f in installed: + writer.writerow((installed[f], '', '')) + shutil.move(temp_record, record) -- Gitee From 69db4fda795bab9d9929e509fc06a3c72c1b1477 Mon Sep 17 00:00:00 2001 From: tianwei Date: Wed, 5 Aug 2020 21:06:18 +0800 Subject: [PATCH 2/3] update python-pip.spec. --- python-pip.spec | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python-pip.spec b/python-pip.spec index d187805..cdf40f6 100644 --- a/python-pip.spec +++ b/python-pip.spec @@ -13,10 +13,11 @@ License: MIT and Python and ASL 2.0 and BSD and ISC and LGPLv2 and MPLv2. URL: http://www.pip-installer.org Source0: https://files.pythonhosted.org/packages/source/p/%{srcname}/%{srcname}-%{version}.tar.gz BuildArch: noarch +Patch0: allow-stripping-given-prefix-from-wheel-RECORD-files.patch Patch1: emit-a-warning-when-running-with-root-privileges.patch Patch2: remove-existing-dist-only-if-path-conflicts.patch -Patch3: dummy-certifi.patch -Source1: pip-allow-different-versions.patch +Patch3: dummy-certifi.patch +Source1: pip-allow-different-versions.patch %description %{_description} -- Gitee From 4918590c15dc654eef9f468a6ebb06cd67eeba41 Mon Sep 17 00:00:00 2001 From: tianwei Date: Wed, 5 Aug 2020 21:08:51 +0800 Subject: [PATCH 3/3] update python-pip.spec. --- python-pip.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python-pip.spec b/python-pip.spec index cdf40f6..51eb6ed 100644 --- a/python-pip.spec +++ b/python-pip.spec @@ -7,7 +7,7 @@ pip is the package installer for Python. You can use pip to install packages fro %global bashcompdir %(b=$(pkg-config --variable=completionsdir bash-completion 2>/dev/null); echo ${b:-%{_sysconfdir}/bash_completion.d}) Name: python-%{srcname} Version: 20.1.1 -Release: 1 +Release: 2 Summary: A tool for installing and managing Python packages License: MIT and Python and ASL 2.0 and BSD and ISC and LGPLv2 and MPLv2.0 and (ASL 2.0 or BSD) URL: http://www.pip-installer.org @@ -105,6 +105,9 @@ install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir} %{python_wheeldir}/%{python_wheelname} %changelog +* Wed Aug 5 2020 tianwei - 20.1.1-2 +- add patch + * Tue Jul 28 2020 jinzhimin - 20.1.1-1 - update to 20.1.1 -- Gitee