summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/toaster/toastermain/settings.py
diff options
context:
space:
mode:
authorAlexandru DAMIAN <alexandru.damian@intel.com>2014-04-01 15:28:15 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-04-09 17:00:00 +0100
commit1d631fba8a76a3f29ff94bdb63c6e8ac140f9e70 (patch)
tree08fa00afa176d88e28ba10a55bd98b70f5e1bfe8 /bitbake/lib/toaster/toastermain/settings.py
parent70288db2e94c100b0b4c74e1260923fc5ce26d25 (diff)
downloadpoky-1d631fba8a76a3f29ff94bdb63c6e8ac140f9e70.tar.gz
bitbake: toaster: do not load all available timezones
This patch makes sure that we only load pytz-recognized timezones. Pytz is used to transform the timezone information for the database queries, and needs to be able to deal with the TIME_ZONE value that we set up. [YOCTO #6093] (Bitbake rev: bfe67472e3ee778b78ef004b2153fa88b3807b92) Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/toaster/toastermain/settings.py')
-rw-r--r--bitbake/lib/toaster/toastermain/settings.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py
index e26ee3c9ee..6e9d85d4c0 100644
--- a/bitbake/lib/toaster/toastermain/settings.py
+++ b/bitbake/lib/toaster/toastermain/settings.py
@@ -64,7 +64,15 @@ else:
64 for dirpath, dirnames, filenames in os.walk(ZONEINFOPATH): 64 for dirpath, dirnames, filenames in os.walk(ZONEINFOPATH):
65 for fn in filenames: 65 for fn in filenames:
66 filepath = os.path.join(dirpath, fn) 66 filepath = os.path.join(dirpath, fn)
67 zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = filepath.lstrip(ZONEINFOPATH).strip() 67 try:
68 import pytz
69 from pytz.exceptions import UnknownTimeZoneError
70 zonename = filepath.lstrip(ZONEINFOPATH).strip()
71 if pytz.timezone(zonename) is not None:
72 zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename
73 except UnknownTimeZoneError, ValueError:
74 # we expect timezone failures here, just move over
75 pass
68 76
69 TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()] 77 TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()]
70 78