From f2b51da0ab451fb097f2a8851896ded5621e151a Mon Sep 17 00:00:00 2001 From: Bruno da Silva de Oliveira Date: Fri, 8 Aug 2003 02:56:04 +0000 Subject: [PATCH] - Fix a bug where a declaration was appearing more than once in an intermediate class in an hierarchy not fully-exported [SVN r19489] --- pyste/src/Pyste/ClassExporter.py | 15 ++++++++------- pyste/tests/test_all.py | 6 +++--- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/pyste/src/Pyste/ClassExporter.py b/pyste/src/Pyste/ClassExporter.py index 3ecf7729..7384245a 100644 --- a/pyste/src/Pyste/ClassExporter.py +++ b/pyste/src/Pyste/ClassExporter.py @@ -111,8 +111,9 @@ class ClassExporter(Exporter): just export one type and automatically get all the members from the base classes. ''' - valid_members = (Method, ClassVariable, NestedClass, ClassOperator, - ConverterOperator, ClassEnumeration) + valid_members = (Method, ClassVariable, NestedClass, ClassEnumeration) + # these don't work INVESTIGATE!: (ClassOperator, ConverterOperator) + fullnames = [x.FullName() for x in self.class_] for level in self.class_.hierarchy: level_exported = False for base in level: @@ -120,17 +121,17 @@ class ClassExporter(Exporter): if base.FullName() not in exported_names: for member in base: if type(member) in valid_members: - member = copy.deepcopy(member) - #if type(member) not in (ClassVariable,: - # member.class_ = self.class_.FullName() - self.class_.AddMember(member) + member_copy = copy.deepcopy(member) + member_copy.class_ = self.class_.FullName() + if member_copy.FullName() not in fullnames: + self.class_.AddMember(member) else: level_exported = True if level_exported: break def IsValid(member): return isinstance(member, valid_members) and member.visibility == Scope.public - self.public_members = [x for x in self.class_ if IsValid(x)] + self.public_members = [x for x in self.class_ if IsValid(x)] def Write(self, codeunit): diff --git a/pyste/tests/test_all.py b/pyste/tests/test_all.py index a0305752..dbbb7713 100644 --- a/pyste/tests/test_all.py +++ b/pyste/tests/test_all.py @@ -10,12 +10,12 @@ import sys #============================================================================= if sys.platform == 'win32': - includes = '-ID:/programming/libraries/boost-cvs/boost -IC:/Python/include' + includes = '-ID:/programming/libraries/boost-cvs/boost -ID:/Bin/Python/include' build_pyste_cmd = 'python ../src/Pyste/pyste.py %s ' % includes compile_single_cmd = 'icl /nologo /GR /GX -c %s -I. ' % includes link_single_cmd = 'link /nologo /DLL '\ - '/libpath:D:/programming/libraries/boost-cvs/lib /libpath:C:/Python/libs '\ - 'boost_python.lib python22.lib /out:_%s.dll ' + '/libpath:D:/programming/libraries/boost-cvs/lib /libpath:D:/Bin/Python/libs '\ + 'boost_python.lib python23.lib /out:_%s.dll ' obj_ext = 'obj' #=============================================================================