[bitbake-devel] [PATCH 07/20] bb/fetch2: Move export_proxies function from wget to utils.
Aníbal Limón
anibal.limon at linux.intel.com
Tue Feb 2 15:15:55 UTC 2016
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 at linux.intel.com>
---
lib/bb/fetch2/wget.py | 17 +----------------
lib/bb/utils.py | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/lib/bb/fetch2/wget.py b/lib/bb/fetch2/wget.py
index 5a31730..fd25c42 100644
--- a/lib/bb/fetch2/wget.py
+++ b/lib/bb/fetch2/wget.py
@@ -37,6 +37,7 @@ from bb.fetch2 import FetchMethod
from bb.fetch2 import FetchError
from bb.fetch2 import logger
from bb.fetch2 import runfetchcmd
+from bb.utils import export_proxies
from bs4 import BeautifulSoup
from bs4 import SoupStrainer
@@ -219,22 +220,6 @@ class Wget(FetchMethod):
return resp
- def export_proxies(d):
- 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
-
class HTTPMethodFallback(urllib2.BaseHandler):
"""
Fallback to GET if HEAD is not allowed (405 HTTP error)
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index ae10213..70b42f3 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
--
2.1.4
More information about the bitbake-devel
mailing list