From 50e694bcc88bf8d4deeabfc0cd2b8e6faa8a880c Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Sun, 27 Dec 2020 20:58:53 +0800 Subject: [PATCH 1/3] [patch tracking] 20201227205849754513 - https://github.com/pypa/pip/commit/7e609a058e60092c8bdd6593da9c986daa144787 --- ...9a058e60092c8bdd6593da9c986daa144787.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 7e609a058e60092c8bdd6593da9c986daa144787.patch diff --git a/7e609a058e60092c8bdd6593da9c986daa144787.patch b/7e609a058e60092c8bdd6593da9c986daa144787.patch new file mode 100644 index 0000000..cac7735 --- /dev/null +++ b/7e609a058e60092c8bdd6593da9c986daa144787.patch @@ -0,0 +1,27 @@ +diff --git a/news/9315.feature.rst b/news/9315.feature.rst +new file mode 100644 +index 0000000000..64d1f25338 +--- /dev/null ++++ b/news/9315.feature.rst +@@ -0,0 +1 @@ ++Improve presentation of XMLRPC errors in pip search. +diff --git a/src/pip/_internal/commands/search.py b/src/pip/_internal/commands/search.py +index a03b2a633e..b3143b72fb 100644 +--- a/src/pip/_internal/commands/search.py ++++ b/src/pip/_internal/commands/search.py +@@ -77,7 +77,14 @@ def search(self, query, options): + + transport = PipXmlrpcTransport(index_url, session) + pypi = xmlrpc_client.ServerProxy(index_url, transport) +- hits = pypi.search({'name': query, 'summary': query}, 'or') ++ try: ++ hits = pypi.search({'name': query, 'summary': query}, 'or') ++ except xmlrpc_client.Fault as fault: ++ message = "XMLRPC request failed [code: {code}]\n{string}".format( ++ code=fault.faultCode, ++ string=fault.faultString, ++ ) ++ raise CommandError(message) + return hits + + -- Gitee From ca176151796ec7e571e34693f4abe2ba7bda88e0 Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Sun, 27 Dec 2020 20:58:54 +0800 Subject: [PATCH 2/3] [patch tracking] 20201227205849754513 - https://github.com/pypa/pip/commit/5ccd226df893df43818158e713ba24a74d82176d --- ...226df893df43818158e713ba24a74d82176d.patch | 303 ++++++++++++++++++ 1 file changed, 303 insertions(+) create mode 100644 5ccd226df893df43818158e713ba24a74d82176d.patch diff --git a/5ccd226df893df43818158e713ba24a74d82176d.patch b/5ccd226df893df43818158e713ba24a74d82176d.patch new file mode 100644 index 0000000..4f0f62b --- /dev/null +++ b/5ccd226df893df43818158e713ba24a74d82176d.patch @@ -0,0 +1,303 @@ +diff --git a/news/f0af302f-aef7-4323-8332-819f0be13d79.trivial.rst b/news/f0af302f-aef7-4323-8332-819f0be13d79.trivial.rst +new file mode 100644 +index 0000000000..e69de29bb2 +diff --git a/setup.cfg b/setup.cfg +index d2bf9fb69d..25850c4cef 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -29,13 +29,6 @@ per-file-ignores = + noxfile.py: G + # B011: Do not call assert False since python -O removes these calls + tests/*: B011 +- # TODO: Remove IOError from except (OSError, IOError) blocks in +- # these files when Python 2 is removed. +- # In Python 3, IOError have been merged into OSError +- # https://github.com/PyCQA/flake8-bugbear/issues/110 +- src/pip/_internal/utils/filesystem.py: B014 +- src/pip/_internal/network/cache.py: B014 +- src/pip/_internal/utils/misc.py: B014 + + [mypy] + follow_imports = silent +diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py +index a9a4478727..cd97ecb604 100644 +--- a/src/pip/_internal/commands/install.py ++++ b/src/pip/_internal/commands/install.py +@@ -435,10 +435,10 @@ def run(self, options, args): + write_output( + 'Successfully installed %s', installed_desc, + ) +- except EnvironmentError as error: ++ except OSError as error: + show_traceback = (self.verbosity >= 1) + +- message = create_env_error_message( ++ message = create_os_error_message( + error, show_traceback, options.use_user_site, + ) + logger.error(message, exc_info=show_traceback) # noqa +@@ -697,16 +697,16 @@ def format_options(option_names): + ) + + +-def create_env_error_message(error, show_traceback, using_user_site): +- # type: (EnvironmentError, bool, bool) -> str +- """Format an error message for an EnvironmentError ++def create_os_error_message(error, show_traceback, using_user_site): ++ # type: (OSError, bool, bool) -> str ++ """Format an error message for an OSError + + It may occur anytime during the execution of the install command. + """ + parts = [] + + # Mention the error if we are not going to show a traceback +- parts.append("Could not install packages due to an EnvironmentError") ++ parts.append("Could not install packages due to an OSError") + if not show_traceback: + parts.append(": ") + parts.append(str(error)) +diff --git a/src/pip/_internal/network/cache.py b/src/pip/_internal/network/cache.py +index 582a7d72dc..9253b20476 100644 +--- a/src/pip/_internal/network/cache.py ++++ b/src/pip/_internal/network/cache.py +@@ -29,7 +29,7 @@ def suppressed_cache_errors(): + """ + try: + yield +- except (OSError, IOError): ++ except OSError: + pass + + +diff --git a/src/pip/_internal/req/req_file.py b/src/pip/_internal/req/req_file.py +index 5e1f71324d..dfa4650904 100644 +--- a/src/pip/_internal/req/req_file.py ++++ b/src/pip/_internal/req/req_file.py +@@ -553,7 +553,7 @@ def get_file_content(url, session): + try: + with open(url, 'rb') as f: + content = auto_decode(f.read()) +- except IOError as exc: ++ except OSError as exc: + raise InstallationError( + f'Could not open requirements file: {exc}' + ) +diff --git a/src/pip/_internal/req/req_tracker.py b/src/pip/_internal/req/req_tracker.py +index 84edbbfae6..daa5b44ca2 100644 +--- a/src/pip/_internal/req/req_tracker.py ++++ b/src/pip/_internal/req/req_tracker.py +@@ -1,5 +1,4 @@ + import contextlib +-import errno + import hashlib + import logging + import os +@@ -103,10 +102,8 @@ def add(self, req): + try: + with open(entry_path) as fp: + contents = fp.read() +- except IOError as e: +- # if the error is anything other than "file does not exist", raise. +- if e.errno != errno.ENOENT: +- raise ++ except FileNotFoundError: ++ pass + else: + message = '{} is already being built: {}'.format( + req.link, contents) +diff --git a/src/pip/_internal/self_outdated_check.py b/src/pip/_internal/self_outdated_check.py +index 56d03a8668..c22f06afe8 100644 +--- a/src/pip/_internal/self_outdated_check.py ++++ b/src/pip/_internal/self_outdated_check.py +@@ -50,7 +50,7 @@ def __init__(self, cache_dir): + try: + with open(self.statefile_path) as statefile: + self.state = json.load(statefile) +- except (IOError, ValueError, KeyError): ++ except (OSError, ValueError, KeyError): + # Explicitly suppressing exceptions, since we don't want to + # error out if the cache file is invalid. + pass +diff --git a/src/pip/_internal/utils/filesystem.py b/src/pip/_internal/utils/filesystem.py +index 1b0c083cfd..dfa2802f71 100644 +--- a/src/pip/_internal/utils/filesystem.py ++++ b/src/pip/_internal/utils/filesystem.py +@@ -1,4 +1,3 @@ +-import errno + import fnmatch + import os + import os.path +@@ -64,7 +63,7 @@ def copy2_fixed(src, dest): + """ + try: + shutil.copy2(src, dest) +- except (OSError, IOError): ++ except OSError: + for f in [src, dest]: + try: + is_socket_file = is_socket(f) +@@ -148,27 +147,22 @@ def _test_writable_dir_win(path): + file = os.path.join(path, name) + try: + fd = os.open(file, os.O_RDWR | os.O_CREAT | os.O_EXCL) +- # Python 2 doesn't support FileExistsError and PermissionError. +- except OSError as e: +- # exception FileExistsError +- if e.errno == errno.EEXIST: +- continue +- # exception PermissionError +- if e.errno == errno.EPERM or e.errno == errno.EACCES: +- # This could be because there's a directory with the same name. +- # But it's highly unlikely there's a directory called that, +- # so we'll assume it's because the parent dir is not writable. +- # This could as well be because the parent dir is not readable, +- # due to non-privileged user access. +- return False +- raise ++ except FileExistsError: ++ pass ++ except PermissionError: ++ # This could be because there's a directory with the same name. ++ # But it's highly unlikely there's a directory called that, ++ # so we'll assume it's because the parent dir is not writable. ++ # This could as well be because the parent dir is not readable, ++ # due to non-privileged user access. ++ return False + else: + os.close(fd) + os.unlink(file) + return True + + # This should never be reached +- raise EnvironmentError( ++ raise OSError( + 'Unexpected condition testing for writable directory' + ) + +diff --git a/src/pip/_internal/utils/misc.py b/src/pip/_internal/utils/misc.py +index e83259eccb..8e475017e3 100644 +--- a/src/pip/_internal/utils/misc.py ++++ b/src/pip/_internal/utils/misc.py +@@ -138,7 +138,7 @@ def rmtree_errorhandler(func, path, exc_info): + read-only attribute, and hopefully continue without problems.""" + try: + has_attr_readonly = not (os.stat(path).st_mode & stat.S_IWRITE) +- except (IOError, OSError): ++ except OSError: + # it's equivalent to os.path.exists + return + +diff --git a/src/pip/_internal/utils/virtualenv.py b/src/pip/_internal/utils/virtualenv.py +index acaceee281..3086bf2fc8 100644 +--- a/src/pip/_internal/utils/virtualenv.py ++++ b/src/pip/_internal/utils/virtualenv.py +@@ -53,7 +53,7 @@ def _get_pyvenv_cfg_lines(): + # writes with UTF-8. (pypa/pip#8717) + with open(pyvenv_cfg_file, encoding='utf-8') as f: + return f.read().splitlines() # avoids trailing newlines +- except IOError: ++ except OSError: + return None + + +diff --git a/src/pip/_internal/vcs/versioncontrol.py b/src/pip/_internal/vcs/versioncontrol.py +index a175e6d846..f40a100594 100644 +--- a/src/pip/_internal/vcs/versioncontrol.py ++++ b/src/pip/_internal/vcs/versioncontrol.py +@@ -1,6 +1,5 @@ + """Handles all VCS (version control) support""" + +-import errno + import logging + import os + import shutil +@@ -772,16 +771,13 @@ def run_command( + extra_environ=extra_environ, + extra_ok_returncodes=extra_ok_returncodes, + log_failed_cmd=log_failed_cmd) +- except OSError as e: ++ except FileNotFoundError: + # errno.ENOENT = no such file or directory + # In other words, the VCS executable isn't available +- if e.errno == errno.ENOENT: +- raise BadCommand( +- 'Cannot find command {cls.name!r} - do you have ' +- '{cls.name!r} installed and in your ' +- 'PATH?'.format(**locals())) +- else: +- raise # re-raise exception if a different error occurred ++ raise BadCommand( ++ 'Cannot find command {cls.name!r} - do you have ' ++ '{cls.name!r} installed and in your ' ++ 'PATH?'.format(**locals())) + + @classmethod + def is_repository_directory(cls, path): +diff --git a/tests/unit/test_command_install.py b/tests/unit/test_command_install.py +index 7b6b38de0f..66eb8ef388 100644 +--- a/tests/unit/test_command_install.py ++++ b/tests/unit/test_command_install.py +@@ -5,7 +5,7 @@ + from pip._vendor.packaging.requirements import Requirement + + from pip._internal.commands.install import ( +- create_env_error_message, ++ create_os_error_message, + decide_user_install, + reject_location_related_install_options, + ) +@@ -81,35 +81,35 @@ def test_rejection_for_location_requirement_options(): + + @pytest.mark.parametrize('error, show_traceback, using_user_site, expected', [ + # show_traceback = True, using_user_site = True +- (EnvironmentError("Illegal byte sequence"), True, True, 'Could not install' +- ' packages due to an EnvironmentError.\n'), +- (EnvironmentError(errno.EACCES, "No file permission"), True, True, 'Could' +- ' not install packages due to an EnvironmentError.\nCheck the' ++ (OSError("Illegal byte sequence"), True, True, 'Could not install' ++ ' packages due to an OSError.\n'), ++ (OSError(errno.EACCES, "No file permission"), True, True, 'Could' ++ ' not install packages due to an OSError.\nCheck the' + ' permissions.\n'), + # show_traceback = True, using_user_site = False +- (EnvironmentError("Illegal byte sequence"), True, False, 'Could not' +- ' install packages due to an EnvironmentError.\n'), +- (EnvironmentError(errno.EACCES, "No file permission"), True, False, 'Could' +- ' not install packages due to an EnvironmentError.\nConsider using the' ++ (OSError("Illegal byte sequence"), True, False, 'Could not' ++ ' install packages due to an OSError.\n'), ++ (OSError(errno.EACCES, "No file permission"), True, False, 'Could' ++ ' not install packages due to an OSError.\nConsider using the' + ' `--user` option or check the permissions.\n'), + # show_traceback = False, using_user_site = True +- (EnvironmentError("Illegal byte sequence"), False, True, 'Could not' +- ' install packages due to an EnvironmentError: Illegal byte' ++ (OSError("Illegal byte sequence"), False, True, 'Could not' ++ ' install packages due to an OSError: Illegal byte' + ' sequence\n'), +- (EnvironmentError(errno.EACCES, "No file permission"), False, True, 'Could' +- ' not install packages due to an EnvironmentError: [Errno 13] No file' ++ (OSError(errno.EACCES, "No file permission"), False, True, 'Could' ++ ' not install packages due to an OSError: [Errno 13] No file' + ' permission\nCheck the permissions.\n'), + # show_traceback = False, using_user_site = False +- (EnvironmentError("Illegal byte sequence"), False, False, 'Could not' +- ' install packages due to an EnvironmentError: Illegal byte sequence' ++ (OSError("Illegal byte sequence"), False, False, 'Could not' ++ ' install packages due to an OSError: Illegal byte sequence' + '\n'), +- (EnvironmentError(errno.EACCES, "No file permission"), False, False, +- 'Could not install packages due to an EnvironmentError: [Errno 13] No' ++ (OSError(errno.EACCES, "No file permission"), False, False, ++ 'Could not install packages due to an OSError: [Errno 13] No' + ' file permission\nConsider using the `--user` option or check the' + ' permissions.\n'), + ]) +-def test_create_env_error_message( ++def test_create_os_error_message( + error, show_traceback, using_user_site, expected + ): +- msg = create_env_error_message(error, show_traceback, using_user_site) ++ msg = create_os_error_message(error, show_traceback, using_user_site) + assert msg == expected -- Gitee From 31bdd73aaaf49cd0b273e84154e7636fa5809bfe Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Sun, 27 Dec 2020 20:58:54 +0800 Subject: [PATCH 3/3] [patch tracking] 20201227205849754513 - update spec file --- python-pip.spec | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/python-pip.spec b/python-pip.spec index 3d035b5..006d63b 100644 --- a/python-pip.spec +++ b/python-pip.spec @@ -6,7 +6,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.2.2 -Release: 3 +Release: 4 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 @@ -16,6 +16,8 @@ Patch1: allow-stripping-given-prefix-from-wheel-RECORD-files.patch Patch2: emit-a-warning-when-running-with-root-privileges.patch Patch3: remove-existing-dist-only-if-path-conflicts.patch Patch6000: dummy-certifi.patch +Patch6001: 7e609a058e60092c8bdd6593da9c986daa144787.patch +Patch6002: 5ccd226df893df43818158e713ba24a74d82176d.patch Source10: pip-allow-older-versions.patch %description %{_description} @@ -112,6 +114,9 @@ install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir} %{python_wheeldir}/%{python_wheelname} %changelog +* 20201227205849754513 patch-tracking 20.2.2-4 +- append patch file of upstream repository from <7e609a058e60092c8bdd6593da9c986daa144787> to <5ccd226df893df43818158e713ba24a74d82176d> + * Wed Nov 4 2020 wangjie -20.2.2-3 - Type:NA - ID:NA @@ -161,4 +166,4 @@ install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir} - DESC: Synchronize a patch * Mon Sep 23 2019 openEuler Buildteam - 18.0-6 -- Package init +- Package init \ No newline at end of file -- Gitee