From 92ff4ab76fe4cbfe44794fcade7f38f49fdf7f3c Mon Sep 17 00:00:00 2001 From: Bruno da Silva de Oliveira Date: Sat, 9 Oct 2004 19:49:09 +0000 Subject: [PATCH] Applied patch by Christian Hudon [SVN r25636] --- pyste/NEWS | 4 ++++ pyste/src/Pyste/CppParser.py | 16 +++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/pyste/NEWS b/pyste/NEWS index cd0f0368..edcda974 100644 --- a/pyste/NEWS +++ b/pyste/NEWS @@ -1,3 +1,7 @@ +9 October 2004 +- Applied a patch by Christian Hudon that fixed an issue with files +that had a tail and relative includes. + 18 July 2004 - Applied a patch by Paul Bridger that solves some problems for wrapper methods. diff --git a/pyste/src/Pyste/CppParser.py b/pyste/src/Pyste/CppParser.py index 0639b237..1bedb25f 100644 --- a/pyste/src/Pyste/CppParser.py +++ b/pyste/src/Pyste/CppParser.py @@ -86,10 +86,16 @@ class CppParser: '''Creates a temporary file, appends the text tail to it, and returns the filename of the file. ''' - temp = tempfile.mktemp('.h') - shutil.copyfile(filename, temp) - f = file(temp, 'a') - f.write('\n\n'+tail) + if hasattr(tempfile, 'mkstemp'): + f_no, temp = tempfile.mkstemp('.h') + f = file(temp, 'a') + os.close(f_no) + else: + temp = tempfile.mktemp('.h') + f = file(temp, 'a') + f.write('#include "%s"\n\n' % os.path.abspath(filename)) + f.write(tail) + f.write('\n') f.close() return temp @@ -153,7 +159,7 @@ class CppParser: ''' if tail is None: tail = '' - tail.strip() + tail = tail.strip() declarations = self.GetCache(header, interface, tail) if declarations is None: declarations = self.ParseWithGCCXML(header, tail)