[oe-commits] [openembedded-core] 23/24: locale fixup

git at git.openembedded.org git at git.openembedded.org
Tue May 24 09:16:27 UTC 2016


rpurdie pushed a commit to branch python3
in repository openembedded-core.

commit 60f87a7bd5afe98e637ad4ef7ff3f680b92e6161
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Sat May 21 15:12:14 2016 +0100

    locale fixup
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/package.bbclass | 9 +++++++--
 meta/lib/oe/packagedata.py   | 6 +++++-
 2 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index 8ea707e..f2df923 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -1256,13 +1256,18 @@ python emit_pkgdata() {
     import json
 
     def write_if_exists(f, pkg, var):
+        def encode(str):
+            import codecs
+            c = codecs.getencoder("unicode_escape")
+            return c(str)[0].decode("latin1")
+
         val = d.getVar('%s_%s' % (var, pkg), True)
         if val:
-            f.write('%s_%s: %s\n' % (var, pkg, val))
+            f.write('%s_%s: %s\n' % (var, pkg, encode(val)))
             return val
         val = d.getVar('%s' % (var), True)
         if val:
-            f.write('%s: %s\n' % (var, val))
+            f.write('%s: %s\n' % (var, encode(val)))
         return val
 
     def write_extra_pkgs(variants, pn, packages, pkgdatadir):
diff --git a/meta/lib/oe/packagedata.py b/meta/lib/oe/packagedata.py
index 9c2fa78..21d4de9 100644
--- a/meta/lib/oe/packagedata.py
+++ b/meta/lib/oe/packagedata.py
@@ -7,6 +7,10 @@ def packaged(pkg, d):
 def read_pkgdatafile(fn):
     pkgdata = {}
 
+    def decode(str):
+        c = codecs.getdecoder("unicode_escape")
+        return c(str)[0]
+
     if os.access(fn, os.R_OK):
         import re
         f = open(fn, 'r')
@@ -16,7 +20,7 @@ def read_pkgdatafile(fn):
         for l in lines:
             m = r.match(l)
             if m:
-                pkgdata[m.group(1)] = m.group(2)
+                pkgdata[m.group(1)] = decode(m.group(2))
 
     return pkgdata
 

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


More information about the Openembedded-commits mailing list