On branch swig-py3: Ensure swig check_output() is decoded as utf8.
To support Python 2 and 3, explicitly decode check_output() return as utf8.
* build/generator/swig/__init__.py
(Generator.__init__, Generator.version): Explicitly decode check_output() as
utf8.
@@ -62,7 +62,7 @@ class Generator:
if os.access(self.swig_path, os.X_OK):
# ### TODO: What's the reason for this os.access() check? It was added
# ### in r873265 (== r33191).
- self.swig_libdir = subprocess.check_output([self.swig_path, "-swiglib"]).strip()
+ self.swig_libdir = subprocess.check_output([self.swig_path, "-swiglib"]).decode('utf8').strip()
else:
self.swig_libdir = None
@@ -71,7 +71,7 @@ class Generator:
"""Get the version number of SWIG"""
if not self._swigVersion:
- swig_version = subprocess.check_output([self.swig_path, "-version"])
+ swig_version = subprocess.check_output([self.swig_path, "-version"]).decode('utf8')
m = re.search("Version (\d+).(\d+).(\d+)", swig_version)
if m:
self._swigVersion = tuple(map(int, m.groups()))
