aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools
diff options
context:
space:
mode:
authorRam Rachum <ram@rachum.com>2020-06-11 22:09:29 +0300
committerRam Rachum <ram@rachum.com>2020-06-11 22:09:29 +0300
commit6588760710433951a1df48c298bdc49fa5bb7c6c (patch)
tree51311fc6d45b02006586695fff1949de5dca032e /setuptools
parent74de4e985eda49e38ece5805e05197dd4d2d9c8a (diff)
downloadexternal_python_setuptools-6588760710433951a1df48c298bdc49fa5bb7c6c.tar.gz
external_python_setuptools-6588760710433951a1df48c298bdc49fa5bb7c6c.tar.bz2
external_python_setuptools-6588760710433951a1df48c298bdc49fa5bb7c6c.zip
Fix exception causes in package_index.py
Diffstat (limited to 'setuptools')
-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