Skip to content

Commit 6226c09

Browse files
committed
Honor 'HTTP_PROXY'/'HTTPS_PROXY' in 'ginstall'.
1 parent 132cc4d commit 6226c09

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

graalpython/lib-graalpython/modules/ginstall.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,16 @@ def system(cmd, msg=""):
5656
def install_from_url(url, patch=None):
5757
name = url[url.rfind("/")+1:]
5858
tempdir = tempfile.mkdtemp()
59-
system("curl -o %s/%s %s" % (tempdir, name, url))
59+
60+
# honor env var 'HTTP_PROXY' and 'HTTPS_PROXY'
61+
env = os.environ
62+
curl_opts = []
63+
if url.startswith("http://") and "HTTP_PROXY" in env:
64+
curl_opts += ["--proxy", env["HTTP_PROXY"]]
65+
elif url.startswith("https://") and "HTTPS_PROXY" in env:
66+
curl_opts += ["--proxy", env["HTTPS_PROXY"]]
67+
68+
system("curl %s -o %s/%s %s" % (" ".join(curl_opts), tempdir, name, url))
6069
if name.endswith(".tar.gz"):
6170
system("tar xzf %s/%s -C %s" % (tempdir, name, tempdir))
6271
bare_name = name[:-len(".tar.gz")]
@@ -395,8 +404,7 @@ def pandas():
395404
396405
dinfo->abstime = (double)(hour * 3600 + minute * 60) + second;
397406
398-
399-
"""
407+
"""
400408
install_from_url("https://files.pythonhosted.org/packages/ee/aa/90c06f249cf4408fa75135ad0df7d64c09cf74c9870733862491ed5f3a50/pandas-0.20.3.tar.gz", patch=patch)
401409

402410
return locals()

0 commit comments

Comments
 (0)