[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#926050: stretch-pu: package python-pip/9.0.1-2+deb9u1



Package: release.debian.org
Severity: normal
Tags: stretch
User: release.debian.org@packages.debian.org
Usertags: pu

Dear release team,

I would like to upload a fix to python-pip to Stretch, fixing pip download
when using --extra-index-url. Pip is indeed broken because of the way pip
handles exceptions from the vendored requests module, and the way Debian
de-embbed requests. The patch is pretty short (2 lines are changed).

Debdiff is attached.

Please allow me to upload python-pip/9.0.1-2+deb9u1 to stretch PU.

Cheers,

Thomas Goirand (zigo)
diff -Nru python-pip-9.0.1/debian/changelog python-pip-9.0.1/debian/changelog
--- python-pip-9.0.1/debian/changelog	2017-01-11 21:48:53.000000000 +0100
+++ python-pip-9.0.1/debian/changelog	2019-03-31 00:02:11.000000000 +0100
@@ -1,3 +1,12 @@
+python-pip (9.0.1-2+deb9u1) stretch; urgency=medium
+
+  * Team upload.
+  * Add Properly_catch_requests_HTTPError_in_index.py.patch, which fixes
+    --extra-index-url results in "HTTPError: 404 Client Error: NOT FOUND".
+    The patch makes works even with the unbundled requests. (Closes: #837764).
+
+ -- Thomas Goirand <zigo@debian.org>  Sun, 31 Mar 2019 00:02:11 +0100
+
 python-pip (9.0.1-2) unstable; urgency=medium
 
   * d/control: Update python-setuptools Built-Using version.
diff -Nru python-pip-9.0.1/debian/patches/Properly_catch_requests_HTTPError_in_index.py.patch python-pip-9.0.1/debian/patches/Properly_catch_requests_HTTPError_in_index.py.patch
--- python-pip-9.0.1/debian/patches/Properly_catch_requests_HTTPError_in_index.py.patch	1970-01-01 01:00:00.000000000 +0100
+++ python-pip-9.0.1/debian/patches/Properly_catch_requests_HTTPError_in_index.py.patch	2019-03-31 00:01:10.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 <clark.boylan@gmail.com>
+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-9.0.1.orig/pip/index.py
++++ python-pip-9.0.1/pip/index.py
+@@ -34,7 +34,7 @@ from pip._vendor import html5lib, reques
+ from pip._vendor.packaging.version import parse as parse_version
+ from pip._vendor.packaging.utils import canonicalize_name
+ from pip._vendor.packaging import specifiers
+-from pip._vendor.requests.exceptions import SSLError
++from pip._vendor.requests.exceptions import HTTPError, SSLError
+ from pip._vendor.distlib.compat import unescape
+ 
+ 
+@@ -809,7 +809,7 @@ class HTMLPage(object):
+                 return
+ 
+             inst = cls(resp.content, resp.url, resp.headers)
+-        except requests.HTTPError as exc:
++        except HTTPError as exc:
+             cls._handle_fail(link, exc, url)
+         except SSLError as exc:
+             reason = ("There was a problem confirming the ssl certificate: "
diff -Nru python-pip-9.0.1/debian/patches/series python-pip-9.0.1/debian/patches/series
--- python-pip-9.0.1/debian/patches/series	2017-01-11 21:48:53.000000000 +0100
+++ python-pip-9.0.1/debian/patches/series	2019-03-31 00:02:05.000000000 +0100
@@ -4,3 +4,4 @@
 set_user_default.patch
 disable-pip-version-check.patch
 html5lib-alternative-beta-name.patch
+Properly_catch_requests_HTTPError_in_index.py.patch

Reply to: