Skip to content

Commit ce71588

Browse files
committed
try first without and then with http proxy
1 parent 460af40 commit ce71588

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

graalpython/lib-graalpython/modules/ginstall.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -491,19 +491,20 @@ def _install_from_url(url, patch=None, extra_opts=[], add_cflags="", ignore_erro
491491
name = url[url.rfind("/")+1:]
492492
tempdir = tempfile.mkdtemp()
493493

494-
# honor env var 'HTTP_PROXY' and 'HTTPS_PROXY'
495-
env = os.environ
496-
curl_opts = []
497-
if url.startswith("http://") and "HTTP_PROXY" in env:
498-
curl_opts += ["--proxy", env["HTTP_PROXY"]]
499-
elif url.startswith("https://") and "HTTPS_PROXY" in env:
500-
curl_opts += ["--proxy", env["HTTPS_PROXY"]]
501-
502494
# honor env var 'CFLAGS' and 'CPPFLAGS'
503495
cppflags = os.environ.get("CPPFLAGS", "")
504496
cflags = "-v " + os.environ.get("CFLAGS", "") + ((" " + add_cflags) if add_cflags else "")
505497

506-
system("curl %s -o %s/%s %s" % (" ".join(curl_opts), tempdir, name, url), msg="Download error")
498+
if os.system("curl -o %s/%s %s" % (tempdir, name, url)) != 0:
499+
# honor env var 'HTTP_PROXY' and 'HTTPS_PROXY'
500+
env = os.environ
501+
curl_opts = []
502+
if url.startswith("http://") and "HTTP_PROXY" in env:
503+
curl_opts += ["--proxy", env["HTTP_PROXY"]]
504+
elif url.startswith("https://") and "HTTPS_PROXY" in env:
505+
curl_opts += ["--proxy", env["HTTPS_PROXY"]]
506+
system("curl %s -o %s/%s %s" % (" ".join(curl_opts), tempdir, name, url), msg="Download error")
507+
507508
if name.endswith(".tar.gz"):
508509
system("tar xzf %s/%s -C %s" % (tempdir, name, tempdir), msg="Error extracting tar.gz")
509510
bare_name = name[:-len(".tar.gz")]

0 commit comments

Comments
 (0)