From c38f70a4e918f0b7e08bf1334cc6e2c85fb8d26a Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Fri, 27 Nov 2020 17:30:11 +0800 Subject: [PATCH 1/2] [patch tracking] 20201127173007638817 - https://github.com/pypa/pip/commit/8b4652efade7c3f9c656f7c921c799a3b0867c9d --- ...52efade7c3f9c656f7c921c799a3b0867c9d.patch | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 8b4652efade7c3f9c656f7c921c799a3b0867c9d.patch diff --git a/8b4652efade7c3f9c656f7c921c799a3b0867c9d.patch b/8b4652efade7c3f9c656f7c921c799a3b0867c9d.patch new file mode 100644 index 0000000..8e2c324 --- /dev/null +++ b/8b4652efade7c3f9c656f7c921c799a3b0867c9d.patch @@ -0,0 +1,64 @@ +diff --git a/news/9160.bugfix.rst b/news/9160.bugfix.rst +new file mode 100644 +index 0000000000..fad6dc1f0d +--- /dev/null ++++ b/news/9160.bugfix.rst +@@ -0,0 +1 @@ ++Redact auth from URL in help message. +diff --git a/src/pip/_internal/cli/parser.py b/src/pip/_internal/cli/parser.py +index b6b78318a7..ea3b383e2f 100644 +--- a/src/pip/_internal/cli/parser.py ++++ b/src/pip/_internal/cli/parser.py +@@ -17,6 +17,7 @@ + from pip._internal.cli.status_codes import UNKNOWN_ERROR + from pip._internal.configuration import Configuration, ConfigurationError + from pip._internal.utils.compat import get_terminal_size ++from pip._internal.utils.misc import redact_auth_from_url + + logger = logging.getLogger(__name__) + +@@ -106,12 +107,22 @@ class UpdatingDefaultsHelpFormatter(PrettyHelpFormatter): + + This is updates the defaults before expanding them, allowing + them to show up correctly in the help listing. ++ ++ Also redact auth from url type options + """ + + def expand_default(self, option): ++ default_value = None + if self.parser is not None: + self.parser._update_defaults(self.parser.defaults) +- return optparse.IndentedHelpFormatter.expand_default(self, option) ++ default_value = self.parser.defaults.get(option.dest) ++ help_text = optparse.IndentedHelpFormatter.expand_default(self, option) ++ ++ if default_value and option.metavar == 'URL': ++ help_text = help_text.replace( ++ default_value, redact_auth_from_url(default_value)) ++ ++ return help_text + + + class CustomOptionParser(optparse.OptionParser): +diff --git a/tests/functional/test_help.py b/tests/functional/test_help.py +index 00a395006b..9c2508abb5 100644 +--- a/tests/functional/test_help.py ++++ b/tests/functional/test_help.py +@@ -64,6 +64,16 @@ def test_help_command_should_exit_status_error_when_cmd_does_not_exist(script): + assert result.returncode == ERROR + + ++def test_help_command_redact_auth_from_url(script): ++ """ ++ Test `help` on various subcommands redact auth from url ++ """ ++ script.environ['PIP_INDEX_URL'] = 'https://user:secret@example.com' ++ result = script.pip('install', '--help') ++ assert result.returncode == SUCCESS ++ assert 'secret' not in result.stdout ++ ++ + def test_help_commands_equally_functional(in_memory_pip): + """ + Test if `pip help` and 'pip --help' behave the same way. -- Gitee From ddf5e8f3d0508fd0cf013a37de885b756b236d3a Mon Sep 17 00:00:00 2001 From: openeuler-ci-bot <80474298@qq.com> Date: Fri, 27 Nov 2020 17:30:11 +0800 Subject: [PATCH 2/2] [patch tracking] 20201127173007638817 - update spec file --- python-pip.spec | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/python-pip.spec b/python-pip.spec index 3d035b5..aff15c4 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,7 @@ 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: 8b4652efade7c3f9c656f7c921c799a3b0867c9d.patch Source10: pip-allow-older-versions.patch %description %{_description} @@ -112,6 +113,9 @@ install -p dist/%{python_wheelname} -t %{buildroot}%{python_wheeldir} %{python_wheeldir}/%{python_wheelname} %changelog +* 20201127173007638817 patch-tracking 20.2.2-4 +- append patch file of upstream repository from <8b4652efade7c3f9c656f7c921c799a3b0867c9d> to <8b4652efade7c3f9c656f7c921c799a3b0867c9d> + * Wed Nov 4 2020 wangjie -20.2.2-3 - Type:NA - ID:NA @@ -161,4 +165,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