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-06-02 08:24:04 +0100 |
| commit | 5074c600f3133cf1f89b4cc0e3b61a6d8fd2236e (patch) | |
| tree | 986b56afd912301a35c66663998fb5cc6a9109c5 /bitbake/lib | |
| parent | cf454d74a88592a4e0981780f30eee60c508d783 (diff) | |
| download | poky-5074c600f3133cf1f89b4cc0e3b61a6d8fd2236e.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: 1414866b84fe1fd674ea79500cd62eda3aa30b33)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
| -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 c7edff2f61..3dfa2b2238 100644 --- a/bitbake/lib/toaster/toastermain/settings.py +++ b/bitbake/lib/toaster/toastermain/settings.py | |||
| @@ -87,17 +87,16 @@ else: | |||
| 87 | try: | 87 | try: |
| 88 | import pytz | 88 | import pytz |
| 89 | from pytz.exceptions import UnknownTimeZoneError | 89 | from pytz.exceptions import UnknownTimeZoneError |
| 90 | pass | ||
| 91 | try: | 90 | try: |
| 92 | if pytz.timezone(zonename) is not None: | 91 | if pytz.timezone(zonename) is not None: |
| 93 | zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename | 92 | zonefilelist[hashlib.md5(open(filepath, 'rb').read()).hexdigest()] = zonename |
| 94 | except UnknownTimeZoneError as ValueError: | 93 | except UnknownTimeZoneError as ValueError: |
| 95 | # we expect timezone failures here, just move over | 94 | # we expect timezone failures here, just move over |
| 96 | pass | 95 | pass |
| 97 | except ImportError: | 96 | except ImportError: |
| 98 | zonefilelist[hashlib.md5(open(filepath).read()).hexdigest()] = zonename | 97 | zonefilelist[hashlib.md5(open(filepath, 'rb').read()).hexdigest()] = zonename |
| 99 | 98 | ||
| 100 | TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime').read()).hexdigest()] | 99 | TIME_ZONE = zonefilelist[hashlib.md5(open('/etc/localtime', 'rb').read()).hexdigest()] |
| 101 | 100 | ||
| 102 | # Language code for this installation. All choices can be found here: | 101 | # Language code for this installation. All choices can be found here: |
| 103 | # http://www.i18nguy.com/unicode/language-identifiers.html | 102 | # http://www.i18nguy.com/unicode/language-identifiers.html |
