[oe-commits] [bitbake] 05/11: utils: Force bitbake to en_US.UTF-8 locale settings

git at git.openembedded.org git at git.openembedded.org
Wed May 11 15:15:33 UTC 2016


rpurdie pushed a commit to branch master-next
in repository bitbake.

commit 66429313ae68ce201f9ba5427f870021e20fbbd1
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Wed May 11 14:18:31 2016 +0100

    utils: Force bitbake to en_US.UTF-8 locale settings
    
    Under python 3, if we spawn a python process, we need to have a UTF-8
    locale, else python's file access methods will use ascii. You can't
    change that mode once the interpreter is started so we have to ensure
    a locale is set. Ideally we'd use C.UTF-8 but not all distros support
    that and we need to set something. Was tempted to choose en_GB so colour
    gets spelt correctly :).
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/utils.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 0c553dd..588c192 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -568,6 +568,7 @@ def preserved_envvars_exported():
         'SHELL',
         'TERM',
         'USER',
+        'LC_ALL',
     ]
 
 def preserved_envvars():
@@ -595,6 +596,12 @@ def filter_environment(good_vars):
         os.unsetenv(key)
         del os.environ[key]
 
+    # If we spawn a python process, we need to have a UTF-8 locale, else python's file
+    # access methods will use ascii. You can't change that mode once the interpreter is
+    # started so we have to ensure a locale is set. Ideally we'd use C.UTF-8 but not all
+    # distros support that and we need to set something.
+    os.environ["LC_ALL"] = "en_US.UTF-8"
+
     if removed_vars:
         logger.debug(1, "Removed the following variables from the environment: %s", ", ".join(removed_vars.keys()))
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list