aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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`