[GRASS-SVN] r42601 -
grass/trunk/lib/python/ctypes/ctypesgencore/parser
svn_grass at osgeo.org
svn_grass at osgeo.org
Sun Jun 20 11:05:26 EDT 2010
Author: glynn
Date: 2010-06-20 15:05:25 +0000 (Sun, 20 Jun 2010)
New Revision: 42601
Modified:
grass/trunk/lib/python/ctypes/ctypesgencore/parser/datacollectingparser.py
Log:
Don't use NamedTemporaryFile
Modified: grass/trunk/lib/python/ctypes/ctypesgencore/parser/datacollectingparser.py
===================================================================
--- grass/trunk/lib/python/ctypes/ctypesgencore/parser/datacollectingparser.py 2010-06-20 14:59:00 UTC (rev 42600)
+++ grass/trunk/lib/python/ctypes/ctypesgencore/parser/datacollectingparser.py 2010-06-20 15:05:25 UTC (rev 42601)
@@ -12,7 +12,7 @@
from ctypesgencore.ctypedescs import *
from ctypesgencore.expressions import *
from ctypesgencore.messages import *
-from tempfile import NamedTemporaryFile
+from tempfile import mkstemp
import os
class DataCollectingParser(ctypesparser.CtypesParser,
@@ -58,15 +58,17 @@
self.already_seen_opaque_enums={}
def parse(self):
- f = NamedTemporaryFile(suffix=".h")
+ fd, fname = mkstemp(suffix=".h")
+ f = os.fdopen(fd, 'w+b')
for header in self.options.other_headers:
print >>f, '#include <%s>' % header
for header in self.headers:
print >>f, '#include "%s"' % os.path.abspath(header)
f.flush()
- ctypesparser.CtypesParser.parse(self,f.name,None)
f.close()
-
+ ctypesparser.CtypesParser.parse(self,fname,None)
+ os.remove(fname)
+
for name, params, expr, (filename,lineno) in self.saved_macros:
self.handle_macro(name, params, expr, filename, lineno)
More information about the grass-commit
mailing list