[gtk-doc] Revert "fixxref: don’t mix and match bytes and strings"



commit d08def88ef56c0ff2d3af7079bafef16b93c2063
Author: Ernestas Kulik <ernestask gnome org>
Date:   Thu May 11 21:53:36 2017 +0300

    Revert "fixxref: don’t mix and match bytes and strings"
    
    This reverts commit 7946cdfa841bb573652f29cd7eee6c4bb4d0f0ef.

 gtkdoc/fixxref.py |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)
---
diff --git a/gtkdoc/fixxref.py b/gtkdoc/fixxref.py
index 0db6c46..4893b87 100755
--- a/gtkdoc/fixxref.py
+++ b/gtkdoc/fixxref.py
@@ -335,7 +335,7 @@ def HighlightSource(options, type, source):
 
     # write source to a temp file
     # FIXME: use .c for now to hint the language to the highlighter
-    with tempfile.NamedTemporaryFile(mode='w+', suffix='.c') as f:
+    with tempfile.NamedTemporaryFile(suffix='.c') as f:
         f.write(source)
         f.flush()
         temp_source_file = f.name
@@ -344,9 +344,8 @@ def HighlightSource(options, type, source):
         logging.info('running %s %s %s', config.highlight, highlight_options, temp_source_file)
 
         # format source
-        # returns bytes, thus needs to be decoded to use in re.sub()
         highlighted_source = subprocess.check_output(
-            [config.highlight] + shlex.split(highlight_options) + [temp_source_file]).decode('utf-8')
+            [config.highlight] + shlex.split(highlight_options) + [temp_source_file])
         logging.debug('result: [%s]', highlighted_source)
         if config.highlight.endswith('/source-highlight'):
             highlighted_source = re.sub(r'^<\!-- .*? -->', '', highlighted_source, flags=re.MULTILINE | 
re.DOTALL)
@@ -372,7 +371,7 @@ def HighlightSourceVim(options, type, source):
     source = HighlightSourcePreProcess(source)
 
     # write source to a temp file
-    with tempfile.NamedTemporaryFile(mode='w+', suffix='.h') as f:
+    with tempfile.NamedTemporaryFile(suffix='.h') as f:
         f.write(source)
         f.flush()
         temp_source_file = f.name


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