[gtk-doc] Revert "Revert "scanobj: Don't depend on the system shell""
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] Revert "Revert "scanobj: Don't depend on the system shell""
- Date: Fri, 3 Nov 2017 19:36:30 +0000 (UTC)
commit 775e4a467dc448a130d33ddcc35a879f8dfb5e97
Author: Stefan Sauer <ensonic users sf net>
Date: Fri Nov 3 20:07:20 2017 +0100
Revert "Revert "scanobj: Don't depend on the system shell""
This reverts commit a0778e6289e939c01138d5d15b98cdff643ade63.
gtkdoc/scangobj.py | 49 +++++++++++++++++++++++++++++++------------------
1 files changed, 31 insertions(+), 18 deletions(-)
---
diff --git a/gtkdoc/scangobj.py b/gtkdoc/scangobj.py
index 235a851..0bfb434 100644
--- a/gtkdoc/scangobj.py
+++ b/gtkdoc/scangobj.py
@@ -29,6 +29,7 @@ import logging
import os
import string
import subprocess
+import shlex
from . import common, config
@@ -1254,32 +1255,44 @@ def run(options):
x_file = options.module + '-scan' + config.exeext
- stdout = ""
- if not options.verbose:
- stdout = ">/dev/null"
+ if options.verbose:
+ call = subprocess.check_call
+ else:
+ call = subprocess.check_output
logging.debug('Intermediate scanner files: %s, %s, %s', c_file, o_file, x_file)
# Compiling scanner
- 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
+ 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
# Linking scanner
- 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
+ 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
# Running scanner
- 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
+ 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
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]