]> code.ossystems Code Review - openembedded-core.git/commitdiff
npm.bbclass: avoid str/byte conversion problems for PKGV and SUMMARY
authorPatrick Ohly <patrick.ohly@intel.com>
Fri, 10 Jun 2016 08:04:51 +0000 (10:04 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sun, 12 Jun 2016 22:42:41 +0000 (23:42 +0100)
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@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
meta/classes/npm.bbclass

index d0d3d8fa03c42f1898717972842dc457cc9e5f8b..95be7518a8b641deda067c59bc3c7ab188038f89 100644 (file)
@@ -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('_', '-'))
 }