From cdc4fa7a6e2090008c99eded329d82a67566cc4d Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Thu, 15 Sep 2011 16:12:40 +0000 Subject: [PATCH] * Don't generate the property if the getter is static * Give a WARNING if there is no unittest file for the etg file. This can be suppressed for the modules that really do not need one. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@69090 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- etgtools/extractors.py | 6 +++++- etgtools/tweaker_tools.py | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/etgtools/extractors.py b/etgtools/extractors.py index a03daa0a..01ad692f 100644 --- a/etgtools/extractors.py +++ b/etgtools/extractors.py @@ -470,6 +470,9 @@ class ClassDef(BaseDef): if countNonDefaultArgs(item) != 0: # TODO: check overloads too continue + # Getters must not be static methods + if item.isStatic: + continue elif prefix == 'Set': prop.setter = item.name # Setters must be able to be called with 1 arg, ensure @@ -794,12 +797,13 @@ class ModuleDef(BaseDef): """ This class holds all the items that will be in the generated module """ - def __init__(self, package, module, name, docstring=''): + def __init__(self, package, module, name, docstring='', check4unittest=True): super(ModuleDef, self).__init__() self.package = package self.module = module self.name = name self.docstring = docstring + self.check4unittest = check4unittest self.headerCode = [] self.cppCode = [] self.initializerCode = [] diff --git a/etgtools/tweaker_tools.py b/etgtools/tweaker_tools.py index eaa4929b..2443e096 100644 --- a/etgtools/tweaker_tools.py +++ b/etgtools/tweaker_tools.py @@ -305,6 +305,8 @@ def getDocsGenerator(): def runGenerators(module): + checkForUnitTestModule(module) + # Create the code generator and make the wrapper code wg = getWrapperGenerator() wg.generate(module) @@ -314,6 +316,12 @@ def runGenerators(module): dg.generate(module) +def checkForUnitTestModule(module): + pathname = 'unittests/test_%s.py' % module.name + if os.path.exists(pathname) or not module.check4unittest: + return + print 'WARNING: Unittest module (%s) not found!' % pathname + #---------------------------------------------------------------------------