From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH v2] toaster: Allow toaster to start without pytz
Date: Wed, 9 Apr 2014 18:20:45 +0100 [thread overview]
Message-ID: <1397064045-30314-1-git-send-email-paul.eggleton@linux.intel.com> (raw)
From: Alexandru DAMIAN <alexandru.damian@intel.com>
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>
---
v2: Fix authorship and indentation issues
lib/toaster/toastermain/settings.py | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/lib/toaster/toastermain/settings.py b/lib/toaster/toastermain/settings.py
index 6e9d85d..645f327 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()]
--
1.9.0
reply other threads:[~2014-04-09 17:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1397064045-30314-1-git-send-email-paul.eggleton@linux.intel.com \
--to=paul.eggleton@linux.intel.com \
--cc=bitbake-devel@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.