2
0
mirror of https://github.com/boostorg/python.git synced 2026-01-28 07:22:31 +00:00

- Fixed bug where Include was not writing the #include in some situations

- Rebuild cache files if pyste version changes


[SVN r19757]
This commit is contained in:
Bruno da Silva de Oliveira
2003-08-23 17:06:37 +00:00
parent 165e294298
commit 3f70253a3f
5 changed files with 19 additions and 8 deletions

View File

@@ -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.

View File

@@ -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()

View File

@@ -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

View File

@@ -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

View File

@@ -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)