aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-06-15 17:14:47 -0400
committerGitHub <noreply@github.com>2020-06-15 17:14:47 -0400
commit55bfb7d86ed09c06db5c40eb2fae37975e2672e6 (patch)
tree39e84599277f620169f8a711f0833195d15890cd
parent3955acbb0da75df804d86a52d6fbcc269075a9d3 (diff)
parent6588760710433951a1df48c298bdc49fa5bb7c6c (diff)
downloadexternal_python_setuptools-55bfb7d86ed09c06db5c40eb2fae37975e2672e6.tar.gz
external_python_setuptools-55bfb7d86ed09c06db5c40eb2fae37975e2672e6.tar.bz2
external_python_setuptools-55bfb7d86ed09c06db5c40eb2fae37975e2672e6.zip
Merge pull request #2189 from cool-RR/2020-06-11-raise-from
Fix exception causes in package_index.py
-rw-r--r--setuptools/package_index.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index 0744ea2a..1702c7c6 100644
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -53,10 +53,10 @@ user_agent = _tmpl.format(
def parse_requirement_arg(spec):
try:
return Requirement.parse(spec)
- except ValueError:
+ except ValueError as e:
raise DistutilsError(
"Not a URL, existing file, or requirement spec: %r" % (spec,)
- )
+ ) from e
def parse_bdist_wininst(name):
@@ -772,7 +772,7 @@ class PackageIndex(Environment):
if warning:
self.warn(warning, msg)
else:
- raise DistutilsError('%s %s' % (url, msg))
+ raise DistutilsError('%s %s' % (url, msg)) from v
except urllib.error.HTTPError as v:
return v
except urllib.error.URLError as v:
@@ -780,7 +780,7 @@ class PackageIndex(Environment):
self.warn(warning, v.reason)
else:
raise DistutilsError("Download error for %s: %s"
- % (url, v.reason))
+ % (url, v.reason)) from v
except http_client.BadStatusLine as v:
if warning:
self.warn(warning, v.line)
@@ -789,13 +789,13 @@ class PackageIndex(Environment):
'%s returned a bad status line. The server might be '
'down, %s' %
(url, v.line)
- )
+ ) from v
except (http_client.HTTPException, socket.error) as v:
if warning:
self.warn(warning, v)
else:
raise DistutilsError("Download error for %s: %s"
- % (url, v))
+ % (url, v)) from v
def _download_url(self, scheme, url, tmpdir):
# Determine download filename