Package: release.debian.org Severity: normal User: [email protected] Usertags: unblock
Please unblock package python-pip The version 18.1-5 includes a fix so that using the --extra-index-url option of pip doesn't result in a "HTTPError: 404 Client Error: NOT FOUND". Note that the bug is Debian specific, and is due to the way upstream calls the requests module, which fails if the requests module is de-vendored / de-embedded from pip, which is what has been done in Debian. Bellow, inline in the body of this mail (sorry, I should have made it an attachment, maybe?) is the debdiff for the package. Note that the changes to the "hands-off-system-packages.patch" may be ignore, it's just produced by a "quilt refresh" of the patch. Reading it, you'll notice that the only thing that changes is the way "except HTTPError as exc:" is done, using the imported "HTTPError" from pip._vendor.requests.exceptions rather than from requests.HTTPError which fails. Note that this bug deeply impacts the OpenStack CI/CD system which deeply relies on pip and the --extra-index-url, which is why I care a lot for this patch to go through. Please unblock python-pip/18.1-5. Cheers, Thomas Goirand (zigo) diff -Nru python-pip-18.1/debian/changelog python-pip-18.1/debian/changelog --- python-pip-18.1/debian/changelog 2019-01-03 17:38:22.000000000 +0100 +++ python-pip-18.1/debian/changelog 2019-03-30 21:10:13.000000000 +0100 @@ -1,3 +1,15 @@ +python-pip (18.1-5) unstable; urgency=medium + + * Team upload. + * Refresh hands-off-system-packages.patch. + * Add Properly_catch_requests_HTTPError_in_index.py.patch: this fixes 404 + when using --extra-index-url due to the way we de-bundle python-requests + from pip. Thanks to Fabio Natali <[email protected]> for the bug report, + Clark Boylan for the patch, and all of the OpenStack infra team for their + help and involving me for this fix (Closes: #837764). + + -- Thomas Goirand <[email protected]> Sat, 30 Mar 2019 21:10:13 +0100 + python-pip (18.1-4) unstable; urgency=medium * Generate Built-Using at the build time (Closes: #831271). diff -Nru python-pip-18.1/debian/patches/hands-off-system-packages.patch python-pip-18.1/debian/patches/hands-off-system-packages.patch --- python-pip-18.1/debian/patches/hands-off-system-packages.patch 2019-01-03 17:38:22.000000000 +0100 +++ python-pip-18.1/debian/patches/hands-off-system-packages.patch 2019-03-30 21:10:13.000000000 +0100 @@ -17,17 +17,18 @@ Patch-Name: hands-off-system-packages.patch --- ---- a/src/pip/_internal/utils/misc.py -+++ b/src/pip/_internal/utils/misc.py -@@ -285,22 +285,40 @@ +Index: python-pip/src/pip/_internal/utils/misc.py +=================================================================== +--- python-pip.orig/src/pip/_internal/utils/misc.py ++++ python-pip/src/pip/_internal/utils/misc.py +@@ -289,22 +289,40 @@ def renames(old, new): def is_local(path): """ - Return True if path is within sys.prefix, if we're running in a virtualenv. -- -- If we're not in a virtualenv, all paths are considered "local." + Return True if this is a path pip is allowed to modify. -+ + +- If we're not in a virtualenv, all paths are considered "local." + If we're in a virtualenv, sys.prefix points to the virtualenv's + prefix; only sys.prefix is considered local. + diff -Nru python-pip-18.1/debian/patches/Properly_catch_requests_HTTPError_in_index.py.patch python-pip-18.1/debian/patches/Properly_catch_requests_HTTPError_in_index.py.patch --- python-pip-18.1/debian/patches/Properly_catch_requests_HTTPError_in_index.py.patch 1970-01-01 01:00:00.000000000 +0100 +++ python-pip-18.1/debian/patches/Properly_catch_requests_HTTPError_in_index.py.patch 2019-03-30 21:10:13.000000000 +0100 @@ -0,0 +1,47 @@ +Description: Properly catch requests' HTTPError in index.py + This resolves issue #4195. + . + In index.py's index retrieval routine we were catching + requests.HTTPError to log and ignore 404s and other similar HTTP server + errors when pulling from (extra-)index-urls. Unfortunately, the actual + path to that exception is requests.exceptions.HTTPError and the alias we + were using does not work when pip is installed with unvendored libs as + with the debian packaged pip. + . + Thankfully the fix is simple. Import and use + requests.exceptions.HTTPError. This comes with the added bonus of + fitting in with the existing handling for RetryError and SSLError. With + this change in place upstream pip and downstream packaged pip should + both catch this exception properly. + . + Note: I've not added any tests cases as I'm unsure how to test the + distro packaging case within pip's testsuite. However, the existing test + suite should hopefully cover that this isn't a regression and I've + manually confirmed that this works with a hacked up debian package + install. Also this is how we handle RetryError and SSLError. +Author: Clark Boylan <[email protected]> +Date: Fri, 29 Mar 2019 10:17:31 -0700 +Origin: upstream, https://github.com/pypa/pip/pull/6367/commits/f8292a304deebcf0e4cda2e40caa226c70030f11 +Bug-Debian: https://bugs.debian.org/837764 +Last-Update: 2019-03-30 + +--- python-pip-18.1.orig/src/pip/_internal/index.py ++++ python-pip-18.1/src/pip/_internal/index.py +@@ -16,7 +16,7 @@ from pip._vendor.distlib.compat import u + from pip._vendor.packaging import specifiers + from pip._vendor.packaging.utils import canonicalize_name + from pip._vendor.packaging.version import parse as parse_version +-from pip._vendor.requests.exceptions import SSLError ++from pip._vendor.requests.exceptions import HTTPError, SSLError + from pip._vendor.six.moves.urllib import parse as urllib_parse + from pip._vendor.six.moves.urllib import request as urllib_request + +@@ -161,7 +161,7 @@ def _get_html_page(link, session=None): + return + + inst = HTMLPage(resp.content, resp.url, resp.headers) +- except requests.HTTPError as exc: ++ except HTTPError as exc: + _handle_get_page_fail(link, exc, url) + except SSLError as exc: + reason = "There was a problem confirming the ssl certificate: " diff -Nru python-pip-18.1/debian/patches/series python-pip-18.1/debian/patches/series --- python-pip-18.1/debian/patches/series 2019-01-03 17:38:22.000000000 +0100 +++ python-pip-18.1/debian/patches/series 2019-03-30 21:10:13.000000000 +0100 @@ -3,3 +3,4 @@ handle-unbundled-requests.patch set_user_default.patch disable-pip-version-check.patch +Properly_catch_requests_HTTPError_in_index.py.patch

