Skip to content

Commit

Permalink
fix fetch logic
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoz committed Oct 28, 2024
1 parent c7e21b3 commit 42fa25f
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions relenv/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,15 @@ def fetch(version, triplet, python, check_hosts=CHECK_HOSTS):
"""
Fetch the specified python build.
"""
try:
url = f"https://github.com/saltstack/relenv/releases/download/v{version}/{python}-{triplet}.tar.xz"
if not check_url(url, timeout=5):
for host in check_hosts:
url = f"https://{host}/relenv/{version}/build/{python}-{triplet}.tar.xz"
if check_url(url, timeout=5):
break
else:
print(f"Unable to find file on any hosts {' '.join(check_hosts)}")
sys.exit(1)
url = f"https://github.com/saltstack/relenv/releases/download/v{version}/{python}-{triplet}.tar.xz"
if not check_url(url, timeout=5):
for host in check_hosts:
url = f"https://{host}/relenv/{version}/build/{python}-{triplet}.tar.xz"
if check_url(url, timeout=5):
break
else:
print(f"Unable to find file on any hosts {' '.join(check_hosts)}")
sys.exit(1)
builddir = work_dir("build", DATA_DIR)
os.makedirs(builddir, exist_ok=True)
download_url(url, builddir)
Expand Down

0 comments on commit 42fa25f

Please sign in to comment.