Use subprocess instead of commands, works on Windows and avoids the evil
authorColin Walters <walters@verbum.org>
Sun, 24 Aug 2008 22:36:08 +0000 (22:36 +0000)
committerColin Walters <walters@src.gnome.org>
Sun, 24 Aug 2008 22:36:08 +0000 (22:36 +0000)
2008-08-24  Colin Walters  <walters@verbum.org>

* tools/g-ir-scanner: Use subprocess instead of
commands, works on Windows and avoids the evil
shell on Unix.

svn path=/trunk/; revision=486

ChangeLog
tools/g-ir-scanner

index 04d4741..940e2dd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-08-24  Colin Walters  <walters@verbum.org>
+
+       * tools/g-ir-scanner: Use subprocess instead of
+       commands, works on Windows and avoids the evil
+       shell on Unix.
+
 2008-08-24  Colin Walters  <walters@verbum.org>
 
        * giscanner/glibtransformer.py: Skip over
index af24598..48c889e 100755 (executable)
@@ -19,7 +19,7 @@
 # 02110-1301, USA.
 #
 
-import commands
+import subprocess
 import optparse
 import os
 import sys
@@ -135,14 +135,15 @@ def main(args):
     primary_library = options.libraries[0]
 
     for package in options.packages:
-        output = commands.getoutput('pkg-config --cflags %s' % (package, ))
+        output = subprocess.Popen(['pkg-config', '--cflags', package], 
+                                  stdout=subprocess.PIPE).communicate()[0]
         pkg_options, unused = parser.parse_args(output.split())
         options.cpp_includes.extend(pkg_options.cpp_includes)
         options.cpp_defines.extend(pkg_options.cpp_defines)
         options.cpp_undefines.extend(pkg_options.cpp_undefines)
 
-        output = commands.getoutput('pkg-config --libs-only-L %s' % (
-            package, ))
+        output = subprocess.Popen(['pkg-config', '--libs-only-L', package],
+                                  stdout=subprocess.PIPE).communicate()[0]
         pkg_options, unused = parser.parse_args(output.split())
         options.library_paths.extend(pkg_options.library_paths)