diff options
author | Alexandru DAMIAN <alexandru.damian@intel.com> | 2014-04-09 17:00:53 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2014-04-09 18:21:40 +0100 |
commit | 40027a6e093c3b7480bfaccbd57e0e613d9a7b71 (patch) | |
tree | 581376da451280ebbde3d75ae2f4899220dd06c1 | |
parent | 6d07b531736c2b304da2dfe661239fd3612b0541 (diff) | |
download | bitbake-40027a6e093c3b7480bfaccbd57e0e613d9a7b71.tar.gz |
toaster: Allow toaster to start without pytz
This patch allows toaster to start without pytz.
Django can work with or without pytz, but in the
time zone fix I mistakenly added a hard dependency
on this module.
This patch eliminates the hard dependency.
Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | lib/toaster/toastermain/settings.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/toaster/toastermain/settings.py b/lib/toaster/toastermain/settings.py index 6e9d85d4c..645f32746 100644 --- a/lib/toaster/toastermain/settings.py +++ b/lib/toaster/toastermain/settings.py @@ -64,15 +64,19 @@ else: for dirpath, dirnames, filenames in os.walk(ZONEINFOPATH): for fn in filenames: filepath = os.path.join(dirpath, fn) + zonename = filepath.lstrip(ZONEINFOPATH).strip() try: import pytz from pytz.exceptions import UnknownTimeZoneError - zonename = filepath.lstrip(ZONEINFOPATH).strip() - if pytz.timezone(zonename) is not None: - zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename - except UnknownTimeZoneError, ValueError: - # we expect timezone failures here, just move over pass + try: + if pytz.timezone(zonename) is not None: + zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename + except UnknownTimeZoneError, ValueError: + # we expect timezone failures here, just move over + pass + except ImportError: + zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()] |