summaryrefslogtreecommitdiffstats
path: root/bitbake/lib
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:40 +0000
commitd0d85a4d6b6961b3558c9f875f3a621d71ffcf92 (patch)
treee6cd4ed904d1faf8eedd30dc5e96ea6e51daa38a /bitbake/lib
parent7226ce2830d8b61457a6bf54c3227e782cc2ca48 (diff)
downloadpoky-d0d85a4d6b6961b3558c9f875f3a621d71ffcf92.tar.gz
bitbake: 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. (Bitbake rev: 85c529044381895556d603a3974de22392646a22) 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 'bitbake/lib')
-rw-r--r--bitbake/lib/bb/fetch2/wget.py17
-rw-r--r--bitbake/lib/bb/utils.py19
2 files changed, 20 insertions, 16 deletions
diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py
index 5a31730a4a..fd25c42436 100644
--- a/bitbake/lib/bb/fetch2/wget.py
+++ b/bitbake/lib/bb/fetch2/wget.py
@@ -37,6 +37,7 @@ from bb.fetch2 import FetchMethod
37from bb.fetch2 import FetchError 37from bb.fetch2 import FetchError
38from bb.fetch2 import logger 38from bb.fetch2 import logger
39from bb.fetch2 import runfetchcmd 39from bb.fetch2 import runfetchcmd
40from bb.utils import export_proxies
40from bs4 import BeautifulSoup 41from bs4 import BeautifulSoup
41from bs4 import SoupStrainer 42from bs4 import SoupStrainer
42 43
@@ -219,22 +220,6 @@ class Wget(FetchMethod):
219 220
220 return resp 221 return resp
221 222
222 def export_proxies(d):
223 variables = ['http_proxy', 'HTTP_PROXY', 'https_proxy', 'HTTPS_PROXY',
224 'ftp_proxy', 'FTP_PROXY', 'no_proxy', 'NO_PROXY']
225 exported = False
226
227 for v in variables:
228 if v in os.environ.keys():
229 exported = True
230 else:
231 v_proxy = d.getVar(v, True)
232 if v_proxy is not None:
233 os.environ[v] = v_proxy
234 exported = True
235
236 return exported
237
238 class HTTPMethodFallback(urllib2.BaseHandler): 223 class HTTPMethodFallback(urllib2.BaseHandler):
239 """ 224 """
240 Fallback to GET if HEAD is not allowed (405 HTTP error) 225 Fallback to GET if HEAD is not allowed (405 HTTP error)
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):
1406 libc.prctl(15, byref(buff), 0, 0, 0) 1406 libc.prctl(15, byref(buff), 0, 0, 0)
1407 except: 1407 except:
1408 pass 1408 pass
1409
1410# export common proxies variables from datastore to environment
1411def export_proxies(d):
1412 import os
1413
1414 variables = ['http_proxy', 'HTTP_PROXY', 'https_proxy', 'HTTPS_PROXY',
1415 'ftp_proxy', 'FTP_PROXY', 'no_proxy', 'NO_PROXY']
1416 exported = False
1417
1418 for v in variables:
1419 if v in os.environ.keys():
1420 exported = True
1421 else:
1422 v_proxy = d.getVar(v, True)
1423 if v_proxy is not None:
1424 os.environ[v] = v_proxy
1425 exported = True
1426
1427 return exported