[gobject-introspection] giscanner: Decode command output for Python 3 compatibility



commit ecbf1460ffe0f1f6fa42fe79b27c22969d194cf5
Author: Simon Feltman <sfeltman src gnome org>
Date:   Mon Apr 28 23:24:36 2014 -0700

    giscanner: Decode command output for Python 3 compatibility
    
    Decode the output of various subprocess calls assuming ascii
    encoding.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=679438

 giscanner/dumper.py      |    3 ++-
 giscanner/scannermain.py |    1 +
 giscanner/shlibs.py      |    1 +
 3 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/giscanner/dumper.py b/giscanner/dumper.py
index 0a59e77..5bc48ad 100644
--- a/giscanner/dumper.py
+++ b/giscanner/dumper.py
@@ -196,7 +196,8 @@ class DumpCompiler(object):
         proc = subprocess.Popen(
             cmd + self._packages,
             stdout=subprocess.PIPE)
-        return proc.communicate()[0].split()
+        out, err = proc.communicate()
+        return out.decode('ascii').split()
 
     def _compile(self, *sources):
         pkgconfig_flags = self._run_pkgconfig('--cflags')
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
index b1b0ff6..628528f 100755
--- a/giscanner/scannermain.py
+++ b/giscanner/scannermain.py
@@ -298,6 +298,7 @@ def process_packages(options, packages):
         # the error output should have already appeared on our stderr,
         # so we just exit
         return 1
+    output = output.decode('ascii')
     # Some pkg-config files on Windows have options we don't understand,
     # so we explicitly filter to only the ones we need.
     options_whitelist = ['-I', '-D', '-U', '-l', '-L']
diff --git a/giscanner/shlibs.py b/giscanner/shlibs.py
index c1f89be..c93d20c 100644
--- a/giscanner/shlibs.py
+++ b/giscanner/shlibs.py
@@ -116,6 +116,7 @@ def _resolve_non_libtool(options, binary, libraries):
 
         shlibs = []
         for line in proc.stdout:
+            line = line.decode('ascii')
             for library, pattern in patterns.items():
                 m = pattern.search(line)
                 if m:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]