Skip to content

Commit 92ff4ab

Browse files
author
Bruno da Silva de Oliveira
committed
Applied patch by Christian Hudon
[SVN r25636]
1 parent 48a6db6 commit 92ff4ab

2 files changed

Lines changed: 15 additions & 5 deletions

File tree

pyste/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
9 October 2004
2+
- Applied a patch by Christian Hudon that fixed an issue with files
3+
that had a tail and relative includes.
4+
15
18 July 2004
26
- Applied a patch by Paul Bridger that solves some problems for wrapper
37
methods.

pyste/src/Pyste/CppParser.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,16 @@ def AppendTail(self, filename, tail):
8686
'''Creates a temporary file, appends the text tail to it, and returns
8787
the filename of the file.
8888
'''
89-
temp = tempfile.mktemp('.h')
90-
shutil.copyfile(filename, temp)
91-
f = file(temp, 'a')
92-
f.write('\n\n'+tail)
89+
if hasattr(tempfile, 'mkstemp'):
90+
f_no, temp = tempfile.mkstemp('.h')
91+
f = file(temp, 'a')
92+
os.close(f_no)
93+
else:
94+
temp = tempfile.mktemp('.h')
95+
f = file(temp, 'a')
96+
f.write('#include "%s"\n\n' % os.path.abspath(filename))
97+
f.write(tail)
98+
f.write('\n')
9399
f.close()
94100
return temp
95101

@@ -153,7 +159,7 @@ def Parse(self, header, interface, tail=None):
153159
'''
154160
if tail is None:
155161
tail = ''
156-
tail.strip()
162+
tail = tail.strip()
157163
declarations = self.GetCache(header, interface, tail)
158164
if declarations is None:
159165
declarations = self.ParseWithGCCXML(header, tail)

0 commit comments

Comments
 (0)