diff --git a/pyste/NEWS b/pyste/NEWS index ce208eb7..f63b97d2 100644 --- a/pyste/NEWS +++ b/pyste/NEWS @@ -1,3 +1,8 @@ +23 August 2003 +Fixed bug where some Imports where not writing their include files. +Now whenever the Pyste version changes, the cache files are rebuilt +automatically. + 19 August 2003 Fixed a bug related to the generation of the bases<> template. diff --git a/pyste/src/Pyste/CppParser.py b/pyste/src/Pyste/CppParser.py index def0dfc4..33ce7190 100644 --- a/pyste/src/Pyste/CppParser.py +++ b/pyste/src/Pyste/CppParser.py @@ -20,7 +20,7 @@ class CppParserError(Exception): pass class CppParser: 'Parses a header file and returns a list of declarations' - def __init__(self, includes=None, defines=None, cache_dir=None): + def __init__(self, includes=None, defines=None, cache_dir=None, version=None): 'includes and defines ar the directives given to gcc' if includes is None: includes = [] @@ -28,6 +28,7 @@ class CppParser: defines = [] self.includes = includes self.defines = defines + self.version = version #if cache_dir is None: # cache_dir = tempfile.mktemp() # self.delete_cache = True @@ -168,6 +169,9 @@ class CppParser: if os.path.isfile(cache_file): f = file(cache_file, 'rb') try: + version = load(f) + if version != self.version: + return None cache = load(f) if cache.has_key(key): self.cache_files.append(cache_file) @@ -195,6 +199,7 @@ class CppParser: if os.path.isfile(cache_file): f = file(cache_file, 'rb') try: + version = load(f) cache = load(f) finally: f.close() @@ -204,6 +209,7 @@ class CppParser: self.cache_files.append(cache_file) f = file(cache_file, 'wb') try: + dump(self.version, f, 1) dump(cache, f, 1) finally: f.close() diff --git a/pyste/src/Pyste/Exporter.py b/pyste/src/Pyste/Exporter.py index d4a702ad..2947308e 100644 --- a/pyste/src/Pyste/Exporter.py +++ b/pyste/src/Pyste/Exporter.py @@ -82,7 +82,8 @@ class Exporter(object): def __eq__(self, other): - return self.Name() == other.Name() + return type(self) is type(other) and self.Name() == other.Name() \ + and self.interface_file == other.interface_file def __ne__(self, other): - return self.Name() != other.Name() + return not self == other diff --git a/pyste/src/Pyste/infos.py b/pyste/src/Pyste/infos.py index 51cddab5..bda45615 100644 --- a/pyste/src/Pyste/infos.py +++ b/pyste/src/Pyste/infos.py @@ -3,7 +3,6 @@ import copy import exporters from ClassExporter import ClassExporter from FunctionExporter import FunctionExporter -from IncludeExporter import IncludeExporter from EnumExporter import EnumExporter from HeaderExporter import HeaderExporter from VarExporter import VarExporter diff --git a/pyste/src/Pyste/pyste.py b/pyste/src/Pyste/pyste.py index 327f9da2..35036813 100644 --- a/pyste/src/Pyste/pyste.py +++ b/pyste/src/Pyste/pyste.py @@ -43,7 +43,7 @@ from CppParser import CppParser, CppParserError import time from declarations import Typedef -__version__ = '0.9.18' +__version__ = '0.9.19' def RecursiveIncludes(include): 'Return a list containg the include dir and all its subdirectories' @@ -205,7 +205,7 @@ def Begin(): for interface in interfaces: ExecuteInterface(interface) # create the parser - parser = CppParser(includes, defines, cache_dir) + parser = CppParser(includes, defines, cache_dir, __version__) try: if not create_cache: if not generate_main: @@ -299,7 +299,6 @@ def GenerateCode(parser, module, out, interfaces, multiple): exported_names = dict([(x.Name(), None) for x in exports]) # order the exports - interfaces_order = OrderInterfaces(interfaces) order = {} for export in exports: if export.interface_file in order: @@ -307,6 +306,7 @@ def GenerateCode(parser, module, out, interfaces, multiple): else: order[export.interface_file] = [export] exports = [] + interfaces_order = OrderInterfaces(interfaces) for interface in interfaces_order: exports.extend(order[interface]) del order @@ -362,7 +362,7 @@ def UsePsyco(): def main(): start = time.clock() - UsePsyco() + #UsePsyco() status = Begin() print '%0.2f seconds' % (time.clock()-start) sys.exit(status)