aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/utils.py
diff options
context:
space:
mode:
authorAníbal Limón <anibal.limon@linux.intel.com>2016-01-28 16:27:52 -0600
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-08 10:52:32 +0000
commit85c529044381895556d603a3974de22392646a22 (patch)
tree98ed9fdbc5fdaecd5b860e6bb0d987f49d8b7ad3 /lib/bb/utils.py
parent934b82badcf063c8ff252d806c2fb019f7a2e55f (diff)
downloadbitbake-85c529044381895556d603a3974de22392646a22.tar.gz
bb/fetch2: Move export_proxies function from wget to utils.
In order to use in other modules since is a common function when needs to get proxies working. Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/utils.py')
-rw-r--r--lib/bb/utils.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 9730b514e..5af80f5c7 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -1406,3 +1406,22 @@ def set_process_name(name):
libc.prctl(15, byref(buff), 0, 0, 0)
except:
pass
+
+# export common proxies variables from datastore to environment
+def export_proxies(d):
+ import os
+
+ variables = ['http_proxy', 'HTTP_PROXY', 'https_proxy', 'HTTPS_PROXY',
+ 'ftp_proxy', 'FTP_PROXY', 'no_proxy', 'NO_PROXY']
+ exported = False
+
+ for v in variables:
+ if v in os.environ.keys():
+ exported = True
+ else:
+ v_proxy = d.getVar(v, True)
+ if v_proxy is not None:
+ os.environ[v] = v_proxy
+ exported = True
+
+ return exported