summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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