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(http://github.com/url,%20patch=None,%20extra_opts=[],%20add_cflags="",%20ignore_erro%3C/div%3E%3C/code%3E%3C/div%3E%3C/td%3E%3C/tr%3E%3Ctr%20class=%22diff-line-row%22%3E%3Ctd%20data-grid-cell-id=%22diff-9da6d4f868a682101892131546ac686b9da38342bdd51f1e173985ea834bd45b-494-494-0%22%20data-selected=%22false%22%20role=%22gridcell%22%20style=%22background-color:var(--bgColor-default);text-align:center" tabindex="-1" valign="top" class="focusable-grid-cell diff-line-number position-relative diff-line-number-neutral left-side">494
494
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)