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:42 +0100 |
commit | 046a9ea30356daf4f3f8f4ddfc5b57fcfd85a27f (patch) | |
tree | 558ec3c6fa67e9e53208c02bb645d80a902f6721 /bitbake/lib/toaster/toastermain | |
parent | 1eb84a84be9edca97fe23a5506b8ceea2943a2f3 (diff) | |
download | poky-046a9ea30356daf4f3f8f4ddfc5b57fcfd85a27f.tar.gz |
bitbake: 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.
(Bitbake rev: 40027a6e093c3b7480bfaccbd57e0e613d9a7b71)
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')
-rw-r--r-- | bitbake/lib/toaster/toastermain/settings.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index 6e9d85d4c0..645f32746d 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py | |||
@@ -64,15 +64,19 @@ 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 | zonename = filepath.lstrip(ZONEINFOPATH).strip() | ||
67 | try: | 68 | try: |
68 | import pytz | 69 | import pytz |
69 | from pytz.exceptions import UnknownTimeZoneError | 70 | 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 | 71 | pass |
72 | try: | ||
73 | if pytz.timezone(zonename) is not None: | ||
74 | zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename | ||
75 | except UnknownTimeZoneError, ValueError: | ||
76 | # we expect timezone failures here, just move over | ||
77 | pass | ||
78 | except ImportError: | ||
79 | zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename | ||
76 | 80 | ||
77 | TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()] | 81 | TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()] |
78 | 82 | ||