From d0d85a4d6b6961b3558c9f875f3a621d71ffcf92 Mon Sep 17 00:00:00 2001 From: Aníbal Limón Date: Thu, 28 Jan 2016 16:27:52 -0600 Subject: bitbake: bb/fetch2: Move export_proxies function from wget to utils. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In order to use in other modules since is a common function when needs to get proxies working. (Bitbake rev: 85c529044381895556d603a3974de22392646a22) Signed-off-by: Aníbal Limón Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- bitbake/lib/bb/utils.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'bitbake/lib/bb/utils.py') diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 9730b514e4..5af80f5c79 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/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 -- cgit v1.2.3-54-g00ecf