[poppler] gtkdoc.py

Albert Astals Cid aacid at kemper.freedesktop.org
Sun Feb 18 21:05:06 UTC 2018


 gtkdoc.py |   19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

New commits:
commit 948d392d9acc3d82b86a260c952095a603fe767f
Author: William Bader <william at newspapersystems.com>
Date:   Sun Feb 18 22:06:02 2018 +0100

    Add python3 support to gtkdoc.py

diff --git a/gtkdoc.py b/gtkdoc.py
index 48f862a3..5440e28d 100644
--- a/gtkdoc.py
+++ b/gtkdoc.py
@@ -21,6 +21,7 @@ import os.path
 import subprocess
 import sys
 
+PY2 = sys.version_info[0] == 2
 
 class GTKDoc(object):
 
@@ -194,14 +195,20 @@ class GTKDoc(object):
 
         if print_output:
             if stdout:
-                try:
-                    sys.stdout.write(stdout.encode("utf-8"))
-                except UnicodeDecodeError:
+                if PY2:
+                    try:
+                        sys.stdout.write(stdout.encode("utf-8"))
+                    except UnicodeDecodeError:
+                        sys.stdout.write(stdout)
+                else:
                     sys.stdout.write(stdout)
             if stderr:
-                try:
-                    sys.stderr.write(stderr.encode("utf-8"))
-                except UnicodeDecodeError:
+                if PY2:
+                    try:
+                        sys.stderr.write(stderr.encode("utf-8"))
+                    except UnicodeDecodeError:
+                        sys.stderr.write(stderr)
+                else:
                     sys.stderr.write(stderr)
 
         if process.returncode != 0:


More information about the poppler mailing list