Skip to contentSkip to conversation

ruby.bbclass: Fix usage with python3

PATCH New Martin Jansa 1 participant 1 message Jun 13, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ruby.bbclass: Fix usage with python3

* otherwise every recipe inheriting ruby fails with:
WARNING: Exception during build_dependencies for GEM_HOME
WARNING: Error during finalise of /home/jenkins/oe/world/shr-core/meta-openembedded/meta-ruby/recipes-devtools/ruby/bundler_git.bb
ERROR: Failure expanding variable RUBY_GEM_VERSION, expression was ${@get_rubygemsversion("/home/jenkins/oe/world/shr-core/tmp-glibc/sysroots/x86_64-linux/usr/bin")} which triggered exception TypeError: can't use a string pattern on a bytes-like object
ERROR: Task 22219 (/home/jenkins/oe/world/shr-core/meta-openembedded/meta-ruby/recipes-devtools/ruby/bundler_git.bb, do_fetch) failed with exit code '1'

---
 meta-ruby/classes/ruby.bbclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meta-ruby/classes/ruby.bbclass +3 -3
index ef844f2..1acf2e0 100644
@@ -18,7 +18,7 @@ def get_rubyversion(p):
     if not isfile(cmd):
        return found_version
 
-    version = subprocess.Popen([cmd, "--version"], stdout=subprocess.PIPE).communicate()[0]
+    version = subprocess.Popen([cmd, "--version"], stdout=subprocess.PIPE).communicate()[0].decode("utf-8")
     
     r = re.compile("ruby ([0-9]+\.[0-9]+\.[0-9]+)*")
     m = r.match(version)
@@ -38,7 +38,7 @@ def get_rubygemslocation(p):
     if not isfile(cmd):
        return found_loc
 
-    loc = subprocess.Popen([cmd, "env"], stdout=subprocess.PIPE).communicate()[0]
+    loc = subprocess.Popen([cmd, "env"], stdout=subprocess.PIPE).communicate()[0].decode("utf-8")
 
     r = re.compile(".*\- (/usr.*/ruby/gems/.*)")
     for line in loc.split('\n'):
@@ -60,7 +60,7 @@ def get_rubygemsversion(p):
     if not isfile(cmd):
        return found_version
 
-    version = subprocess.Popen([cmd, "env", "gemdir"], stdout=subprocess.PIPE).communicate()[0]
+    version = subprocess.Popen([cmd, "env", "gemdir"], stdout=subprocess.PIPE).communicate()[0].decode("utf-8")
     
     r = re.compile(".*([0-9]+\.[0-9]+\.[0-9]+)$")
     m = r.match(version)
Signature · 1 line
2.8.4