Bug 1406 - waf exits with maximum recursion depth exceeded while calling a Python object if wscript has wrong filename
authorGustavo J. A. M. Carneiro <gjc@inescporto.pt>
Fri, 06 Apr 2012 16:05:51 +0100
changeset 7821 270a2b7f82ad
parent 7820 9ebf12703683
child 7822 66570eb8a685
Bug 1406 - waf exits with maximum recursion depth exceeded while calling a Python object if wscript has wrong filename
src/wscript
wscript
--- a/src/wscript	Tue Apr 03 18:59:41 2012 +0200
+++ b/src/wscript	Fri Apr 06 16:05:51 2012 +0100
@@ -125,7 +125,7 @@
     module.env.append_value("INCLUDES", '#')
 
     module.pcfilegen = bld(features='ns3pcfile')
-    module.pcfilegen.module = module
+    module.pcfilegen.module = module.name
     
     return module
 
@@ -413,13 +413,14 @@
 @TaskGen.feature('ns3pcfile')
 @TaskGen.after_method('process_rule')
 def apply(self):
-    output_filename = 'lib%s.pc' % os.path.basename(self.module.target)
+    module = self.bld.find_ns3_module(self.module)
+    output_filename = 'lib%s.pc' % os.path.basename(module.target)
     output_node = self.path.find_or_declare(output_filename)
     assert output_node is not None, str(self)
     task = self.create_task('ns3pcfile')
     self.bld.install_files('${LIBDIR}/pkgconfig', output_node)
     task.set_outputs([output_node])
-    task.module = self.module
+    task.module = module
 
 
 
--- a/wscript	Tue Apr 03 18:59:41 2012 +0200
+++ b/wscript	Fri Apr 06 16:05:51 2012 +0100
@@ -666,6 +666,14 @@
         break
 
 
+def _find_ns3_module(self, name):
+    for obj in _get_all_task_gen(self):
+        # disable the modules themselves
+        if hasattr(obj, "is_ns3_module") and obj.name == name:
+            return obj
+    raise KeyError(name)
+
+
 def build(bld):
     env = bld.env
 
@@ -694,6 +702,7 @@
     bld.create_suid_program = types.MethodType(create_suid_program, bld)
     bld.__class__.all_task_gen = property(_get_all_task_gen)
     bld.exclude_taskgen = types.MethodType(_exclude_taskgen, bld)
+    bld.find_ns3_module = types.MethodType(_find_ns3_module, bld)
 
     # process subfolders from here
     bld.add_subdirs('src')
@@ -776,7 +785,7 @@
 
             # disable pcfile taskgens for disabled modules
             if 'ns3pcfile' in getattr(obj, "features", []):
-                if obj.module.name not in bld.env.NS3_ENABLED_MODULES:
+                if obj.module not in bld.env.NS3_ENABLED_MODULES:
                     bld.exclude_taskgen(obj)