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'

Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
This commit is contained in:
Martin Jansa 2016-06-13 15:59:39 +02:00
parent 44ea80d3a3
commit 548effebf1

View File

@ -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)