diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-05-10 17:18:22 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-16 23:32:42 +0100 |
commit | a6a36a91308f4303fdc723f354b7b88e55b84620 (patch) | |
tree | 7688ef02fe6c5f0b40802b6e190592c9db7380af /bitbake | |
parent | 5582444b10418bef14ff274a2470a9050d7a7e17 (diff) | |
download | poky-a6a36a91308f4303fdc723f354b7b88e55b84620.tar.gz |
bitbake: toaster: read timezone files in binary mode
Used 'rb' mode to open files to avoid unicode error when code
runs on python 3:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80
in position 44: invalid start byte
[YOCTO #9584]
(Bitbake rev: 9e89fbe5682943d0d7e532d0a9f6188f60ba2349)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/toaster/toastermain/settings.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/bitbake/lib/toaster/toastermain/settings.py b/bitbake/lib/toaster/toastermain/settings.py index 78702fa59e..ce232e0865 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py | |||
@@ -134,17 +134,16 @@ else: | |||
134 | try: | 134 | try: |
135 | import pytz | 135 | import pytz |
136 | from pytz.exceptions import UnknownTimeZoneError | 136 | from pytz.exceptions import UnknownTimeZoneError |
137 | pass | ||
138 | try: | 137 | try: |
139 | if pytz.timezone(zonename) is not None: | 138 | if pytz.timezone(zonename) is not None: |
140 | zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename | 139 | zonefilelist[hashlib.md5(open(filepath, 'rb').read()).hexdigest()] = zonename |
141 | except UnknownTimeZoneError as ValueError: | 140 | except UnknownTimeZoneError as ValueError: |
142 | # we expect timezone failures here, just move over | 141 | # we expect timezone failures here, just move over |
143 | pass | 142 | pass |
144 | except ImportError: | 143 | except ImportError: |
145 | zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename | 144 | zonefilelist[hashlib.md5(open(filepath, 'rb').read()).hexdigest()] = zonename |
146 | 145 | ||
147 | TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()] | 146 | TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime', 'rb').read()).hexdigest()] |
148 | 147 | ||
149 | # Language code for this installation. All choices can be found here: | 148 | # Language code for this installation. All choices can be found here: |
150 | # http://www.i18nguy.com/unicode/language-identifiers.html | 149 | # http://www.i18nguy.com/unicode/language-identifiers.html |