Skip to content

Commit d41c95d

Browse files
committed
follow redirects
1 parent 39968b4 commit d41c95d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

graalpython/lib-graalpython/modules/ginstall.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -494,15 +494,15 @@ def _install_from_url(url, patch=None, extra_opts=[], add_cflags="", ignore_erro
494494
cppflags = os.environ.get("CPPFLAGS", "")
495495
cflags = "-v " + os.environ.get("CFLAGS", "") + ((" " + add_cflags) if add_cflags else "")
496496

497-
if os.system("curl -o %s/%s %s" % (tempdir, name, url)) != 0:
497+
if os.system("curl -L -o %s/%s %s" % (tempdir, name, url)) != 0:
498498
# honor env var 'HTTP_PROXY' and 'HTTPS_PROXY'
499499
env = os.environ
500500
curl_opts = []
501501
if url.startswith("http://") and "HTTP_PROXY" in env:
502502
curl_opts += ["--proxy", env["HTTP_PROXY"]]
503503
elif url.startswith("https://") and "HTTPS_PROXY" in env:
504504
curl_opts += ["--proxy", env["HTTPS_PROXY"]]
505-
system("curl %s -o %s/%s %s" % (" ".join(curl_opts), tempdir, name, url), msg="Download error")
505+
system("curl -L %s -o %s/%s %s" % (" ".join(curl_opts), tempdir, name, url), msg="Download error")
506506

507507
if name.endswith(".tar.gz"):
508508
system("tar xzf %s/%s -C %s" % (tempdir, name, tempdir), msg="Error extracting tar.gz")
@@ -544,7 +544,8 @@ def install_from_pypi(package, patch=None, extra_opts=[], add_cflags="", ignore_
544544
# this is already the url to the actual package
545545
pass
546546
else:
547-
r = subprocess.check_output("curl %s" % url, shell=True).decode("utf8")
547+
r = subprocess.check_output("curl -L %s" % url, shell=True).decode("utf8")
548+
url = None
548549
try:
549550
urls = json.loads(r)["urls"]
550551
except:

0 commit comments

Comments
 (0)