summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2015-11-04 20:24:02 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-11-24 15:55:41 +0000
commitccb1616e5459dd31d6a1ba70dc39136b581463ac (patch)
treed69445401f0e57344b24665c60f8987c0f12d1b9 /meta/lib
parent8137a846fb7ffcd68416ef52d55740f98acfe582 (diff)
downloadpoky-ccb1616e5459dd31d6a1ba70dc39136b581463ac.tar.gz
lib/oe/distro_check: don't set empty proxy keys
If the proxies dictionary has a proxy set to None urllib will throw an exception instead of not using a proxy (abridged stack): File: '/home/ross/Yocto/poky/meta/lib/oe/distro_check.py', lineno: 43, function: get_links_from_url *** 0043: with create_socket(url,d) as sock: 0044: webpage = sock.read() File: '/home/ross/Yocto/poky/meta/lib/oe/distro_check.py', lineno: 5, function: create_socket 0003:def create_socket(url, d): 0004: import urllib *** 0005: socket = urllib.urlopen(url, proxies=get_proxies(d)) File: '/usr/lib/python2.7/urllib.py', lineno: 87, function: urlopen 0086: if data is None: *** 0087: return opener.open(url) File: '/usr/lib/python2.7/urllib.py', lineno: 203, function: open 0201: else: 0202: proxy = None *** 0203: name = 'open_' + urltype 0204: self.type = urltype 0205: name = name.replace('-', '_') Exception: TypeError: cannot concatenate 'str' and 'NoneType' objects Filter out unset values so that the dictionary only has valid assignments in. (From OE-Core rev: 2d91290ab5608dd1297d1c26ab807fc4574a8a6b) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/distro_check.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/meta/lib/oe/distro_check.py b/meta/lib/oe/distro_check.py
index f92cd2e423..8655a6fc14 100644
--- a/meta/lib/oe/distro_check.py
+++ b/meta/lib/oe/distro_check.py
@@ -9,10 +9,12 @@ def create_socket(url, d):
9 socket.close() 9 socket.close()
10 10
11def get_proxies(d): 11def get_proxies(d):
12 import os 12 proxies = {}
13 proxykeys = ['http', 'https', 'ftp', 'ftps', 'no', 'all'] 13 for key in ['http', 'https', 'ftp', 'ftps', 'no', 'all']:
14 proxyvalues = map(lambda key: d.getVar(key+'_proxy', True), proxykeys) 14 proxy = d.getVar(key + '_proxy', True)
15 return dict(zip(proxykeys, proxyvalues)) 15 if proxy:
16 proxies[key] = proxy
17 return proxies
16 18
17def get_links_from_url(url, d): 19def get_links_from_url(url, d):
18 "Return all the href links found on the web location" 20 "Return all the href links found on the web location"