[ctypes-commit] ctypes/sandbox/tools/codegen cparser.py,1.6,1.7
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2005-01-21 11:58:07
|
Update of /cvsroot/ctypes/ctypes/sandbox/tools/codegen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25155 Modified Files: cparser.py Log Message: Use subprocess, if available, to run gccxml. Index: cparser.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/sandbox/tools/codegen/cparser.py,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** cparser.py 21 Jan 2005 11:21:00 -0000 1.6 --- cparser.py 21 Jan 2005 11:57:59 -0000 1.7 *************** *** 2,5 **** --- 2,10 ---- from cparser_config import C_KEYWORDS, EXCLUDED, EXCLUDED_RE import gccxmlparser, typedesc + try: + import subprocess + except ImportError: + subprocess = None + if sys.platform == "win32": *************** *** 44,51 **** if lines and self.options.flags: args.extend(self.options.flags) ! print "run", " ".join(args) ! i, o = os.popen4(" ".join(args)) ! i.close() ! data = o.read() finally: os.remove(fname) --- 49,62 ---- if lines and self.options.flags: args.extend(self.options.flags) ! print "run", args ! if subprocess: ! proc = subprocess.Popen(args, ! stdout=subprocess.PIPE, ! stdin=subprocess.PIPE) ! data, err = proc.communicate() ! else: ! i, o = os.popen4(" ".join(args)) ! i.close() ! data = o.read() finally: os.remove(fname) *************** *** 62,66 **** args.extend(self.options.flags) try: ! retcode = os.system(" ".join(args)) if retcode: raise CompilerError, "gccxml returned %s" % retcode --- 73,81 ---- args.extend(self.options.flags) try: ! print "run", args ! if subprocess: ! retcode = subprocess.call(args) ! else: ! retcode = os.system(" ".join(args)) if retcode: raise CompilerError, "gccxml returned %s" % retcode |