aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2016-07-25 10:47:20 -0400
committerGitHub <noreply@github.com>2016-07-25 10:47:20 -0400
commit1b94bbac06022449d320c922e357f62dde43962a (patch)
tree80b42ac0d0b409ce823a74893b91e237a245d8c2
parenta4b7c659a63c924040fc03e96bf4befe4f11979d (diff)
parent87c776227a5bf3443cddc9f26255ff7ab90d9829 (diff)
downloadexternal_python_setuptools-1b94bbac06022449d320c922e357f62dde43962a.tar.gz
external_python_setuptools-1b94bbac06022449d320c922e357f62dde43962a.tar.bz2
external_python_setuptools-1b94bbac06022449d320c922e357f62dde43962a.zip
Merge pull request #609 from JensTimmerman/check_downloads
check if a download is successfull before deciding not to try the nex…
-rw-r--r--CHANGES.rst5
-rwxr-xr-xsetuptools/package_index.py12
2 files changed, 12 insertions, 5 deletions
diff --git a/CHANGES.rst b/CHANGES.rst
index a1ef21c2..4f366f74 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -19,6 +19,11 @@ v25.0.1
* More style cleanup. See #677, #678, #679, #681, #685.
+* #609: setuptools will now try to download a distribution from
+ the next possible download location if the first download fails.
+ This means you can now specify multiple links as ``dependency_links``
+ and all links will be tried until a working download link is encountered.
+
v25.0.0
-------
diff --git a/setuptools/package_index.py b/setuptools/package_index.py
index 0ea09bd6..8d965f49 100755
--- a/setuptools/package_index.py
+++ b/setuptools/package_index.py
@@ -602,15 +602,17 @@ class PackageIndex(Environment):
continue
if dist in req and (dist.precedence <= SOURCE_DIST or not source):
- return dist
+ dist.download_location = self.download(dist.location, tmpdir)
+ if os.path.exists(dist.download_location):
+ return dist
if force_scan:
self.prescan()
self.find_packages(requirement)
dist = find(requirement)
- if local_index is not None:
- dist = dist or find(requirement, local_index)
+ if not dist and local_index is not None:
+ dist = find(requirement, local_index)
if dist is None:
if self.to_scan is not None:
@@ -623,13 +625,13 @@ class PackageIndex(Environment):
if dist is None:
self.warn(
- "No local packages or download links found for %s%s",
+ "No local packages or working download links found for %s%s",
(source and "a source distribution of " or ""),
requirement,
)
else:
self.info("Best match: %s", dist)
- return dist.clone(location=self.download(dist.location, tmpdir))
+ return dist.clone(location=dist.download_location)
def fetch(self, requirement, tmpdir, force_scan=False, source=False):
"""Obtain a file suitable for fulfilling `requirement`