[oe-commits] [openembedded-core] 28/47: npm.bbclass: avoid str/byte conversion problems for PKGV and SUMMARY

git at git.openembedded.org git at git.openembedded.org
Sun Jun 12 22:48:10 UTC 2016


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

commit 241e094bcd9212204350f9855257474908f82a3c
Author: Patrick Ohly <patrick.ohly at intel.com>
AuthorDate: Fri Jun 10 10:04:51 2016 +0200

    npm.bbclass: avoid str/byte conversion problems for PKGV and SUMMARY
    
    In Python3, str.encode() returns byte strings, which later are not
    converted back to strings automatically, leading to "TypeError: Can't
    convert 'bytes' object to str implicitly" in code which reads PKGV and
    SUMMARY and expects to find strings there.
    
    The npm.bbclass must use values for d.setVar() that meet that
    expectation, and thus the redundant (and in Python3, harmful)
    .encode() gets removed.
    
    Signed-off-by: Patrick Ohly <patrick.ohly at intel.com>
    Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/classes/npm.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index d0d3d8f..95be751 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -46,10 +46,10 @@ python populate_packages_prepend () {
         if pdata:
             version = pdata.get('version', None)
             if version:
-                d.setVar('PKGV_%s' % expanded_pkgname, version.encode("utf8"))
+                d.setVar('PKGV_%s' % expanded_pkgname, version)
             description = pdata.get('description', None)
             if description:
-                d.setVar('SUMMARY_%s' % expanded_pkgname, description.replace(u"\u2018", "'").replace(u"\u2019", "'").encode("utf8"))
+                d.setVar('SUMMARY_%s' % expanded_pkgname, description.replace(u"\u2018", "'").replace(u"\u2019", "'"))
     d.appendVar('RDEPENDS_%s' % d.getVar('PN', True), ' %s' % ' '.join(pkgnames).replace('_', '-'))
 }
 

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


More information about the Openembedded-commits mailing list