Skip to content

Commit 3f70253

Browse files
author
Bruno da Silva de Oliveira
committed
- Fixed bug where Include was not writing the #include in some situations
- Rebuild cache files if pyste version changes [SVN r19757]
1 parent 165e294 commit 3f70253

File tree

5 files changed

+19
-8
lines changed

5 files changed

+19
-8
lines changed

pyste/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
23 August 2003
2+
Fixed bug where some Imports where not writing their include files.
3+
Now whenever the Pyste version changes, the cache files are rebuilt
4+
automatically.
5+
16
19 August 2003
27
Fixed a bug related to the generation of the bases<> template.
38

pyste/src/Pyste/CppParser.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,15 @@ class CppParserError(Exception): pass
2020
class CppParser:
2121
'Parses a header file and returns a list of declarations'
2222

23-
def __init__(self, includes=None, defines=None, cache_dir=None):
23+
def __init__(self, includes=None, defines=None, cache_dir=None, version=None):
2424
'includes and defines ar the directives given to gcc'
2525
if includes is None:
2626
includes = []
2727
if defines is None:
2828
defines = []
2929
self.includes = includes
3030
self.defines = defines
31+
self.version = version
3132
#if cache_dir is None:
3233
# cache_dir = tempfile.mktemp()
3334
# self.delete_cache = True
@@ -168,6 +169,9 @@ def GetCache(self, header, interface, tail):
168169
if os.path.isfile(cache_file):
169170
f = file(cache_file, 'rb')
170171
try:
172+
version = load(f)
173+
if version != self.version:
174+
return None
171175
cache = load(f)
172176
if cache.has_key(key):
173177
self.cache_files.append(cache_file)
@@ -195,6 +199,7 @@ def CreateCache(self, header, interface, tail, declarations):
195199
if os.path.isfile(cache_file):
196200
f = file(cache_file, 'rb')
197201
try:
202+
version = load(f)
198203
cache = load(f)
199204
finally:
200205
f.close()
@@ -204,6 +209,7 @@ def CreateCache(self, header, interface, tail, declarations):
204209
self.cache_files.append(cache_file)
205210
f = file(cache_file, 'wb')
206211
try:
212+
dump(self.version, f, 1)
207213
dump(cache, f, 1)
208214
finally:
209215
f.close()

pyste/src/Pyste/Exporter.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ def Header(self):
8282

8383

8484
def __eq__(self, other):
85-
return self.Name() == other.Name()
85+
return type(self) is type(other) and self.Name() == other.Name() \
86+
and self.interface_file == other.interface_file
8687

8788
def __ne__(self, other):
88-
return self.Name() != other.Name()
89+
return not self == other

pyste/src/Pyste/infos.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import exporters
44
from ClassExporter import ClassExporter
55
from FunctionExporter import FunctionExporter
6-
from IncludeExporter import IncludeExporter
76
from EnumExporter import EnumExporter
87
from HeaderExporter import HeaderExporter
98
from VarExporter import VarExporter

pyste/src/Pyste/pyste.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
import time
4444
from declarations import Typedef
4545

46-
__version__ = '0.9.18'
46+
__version__ = '0.9.19'
4747

4848
def RecursiveIncludes(include):
4949
'Return a list containg the include dir and all its subdirectories'
@@ -205,7 +205,7 @@ def Begin():
205205
for interface in interfaces:
206206
ExecuteInterface(interface)
207207
# create the parser
208-
parser = CppParser(includes, defines, cache_dir)
208+
parser = CppParser(includes, defines, cache_dir, __version__)
209209
try:
210210
if not create_cache:
211211
if not generate_main:
@@ -299,14 +299,14 @@ def GenerateCode(parser, module, out, interfaces, multiple):
299299
exported_names = dict([(x.Name(), None) for x in exports])
300300

301301
# order the exports
302-
interfaces_order = OrderInterfaces(interfaces)
303302
order = {}
304303
for export in exports:
305304
if export.interface_file in order:
306305
order[export.interface_file].append(export)
307306
else:
308307
order[export.interface_file] = [export]
309308
exports = []
309+
interfaces_order = OrderInterfaces(interfaces)
310310
for interface in interfaces_order:
311311
exports.extend(order[interface])
312312
del order
@@ -362,7 +362,7 @@ def UsePsyco():
362362

363363
def main():
364364
start = time.clock()
365-
UsePsyco()
365+
#UsePsyco()
366366
status = Begin()
367367
print '%0.2f seconds' % (time.clock()-start)
368368
sys.exit(status)

0 commit comments

Comments
 (0)