[gtk-doc] Revert "scanobj: Don't depend on the system shell"



commit a0778e6289e939c01138d5d15b98cdff643ade63
Author: Michael Catanzaro <mcatanzaro igalia com>
Date:   Thu Nov 2 14:35:21 2017 -0500

    Revert "scanobj: Don't depend on the system shell"
    
    This reverts commit d334d55c1156d3286c272efe3b1d6c8c03541363.
    
    This broke gtk-doc generation for WebKit.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=789800

 gtkdoc/scangobj.py |   49 ++++++++++++++++++-------------------------------
 1 files changed, 18 insertions(+), 31 deletions(-)
---
diff --git a/gtkdoc/scangobj.py b/gtkdoc/scangobj.py
index 0bfb434..235a851 100644
--- a/gtkdoc/scangobj.py
+++ b/gtkdoc/scangobj.py
@@ -29,7 +29,6 @@ import logging
 import os
 import string
 import subprocess
-import shlex
 
 from . import common, config
 
@@ -1255,44 +1254,32 @@ def run(options):
 
     x_file = options.module + '-scan' + config.exeext
 
-    if options.verbose:
-        call = subprocess.check_call
-    else:
-        call = subprocess.check_output
+    stdout = ""
+    if not options.verbose:
+        stdout = ">/dev/null"
 
     logging.debug('Intermediate scanner files: %s, %s, %s', c_file, o_file, x_file)
 
     # Compiling scanner
-    try:
-        call(shlex.split(options.cc) + shlex.split(options.cflags) +
-             ["-c", "-o", o_file, c_file])
-    except subprocess.CalledProcessError as e:
-        logging.warning('Compilation of scanner failed: %d', e.returncode)
-        return e.returncode
-    except OSError as e:
-        logging.warning(str(e))
-        return 1
+    command = '%s %s %s -c -o %s %s' % (options.cc, stdout, options.cflags, o_file, c_file)
+    res = subprocess.check_call(command, shell=True)
+    if res > 0:
+        logging.warning('Compilation of scanner failed: %d', res)
+        return res
 
     # Linking scanner
-    try:
-        call(shlex.split(options.ld) + [o_file] +
-             shlex.split(options.ldflags) + ['-o', x_file])
-    except subprocess.CalledProcessError as e:
-        logging.warning('Linking of scanner failed: %d', e.returncode)
-        return e.returncode
-    except OSError as e:
-        logging.warning(str(e))
-        return 1
+    command = '%s %s %s %s -o %s' % (options.ld, stdout, o_file, options.ldflags, x_file)
+    res = subprocess.check_call(command, shell=True)
+    if res > 0:
+        logging.warning('Linking of scanner failed: %d', res)
+        return res
 
     # Running scanner
-    try:
-        call(shlex.split(options.run) + ['./' + x_file])
-    except subprocess.CalledProcessError as e:
-        logging.warning('Running scanner failed: %d', e.returncode)
-        return e.returncode
-    except OSError as e:
-        logging.warning(str(e))
-        return 1
+    command = '%s ./%s' % (options.run, x_file)
+    res = subprocess.check_call(command, shell=True)
+    if res > 0:
+        logging.warning('Running scanner failed: %d', res)
+        return res
 
     logging.debug('Scan complete')
     if 'GTK_DOC_KEEP_INTERMEDIATE' not in os.environ:


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