--- a/bindings/python/ns3modulescan-modular.py Sun Mar 20 14:18:56 2011 +0000
+++ b/bindings/python/ns3modulescan-modular.py Sun Mar 20 15:08:20 2011 +0000
@@ -35,7 +35,10 @@
l = []
head = path
while head:
- head, tail = os.path.split(head)
+ new_head, tail = os.path.split(head)
+ if new_head == head:
+ raise ValueError
+ head = new_head
if tail == 'ns3':
return os.path.join(*l)
l.insert(0, tail)
@@ -51,7 +54,11 @@
pygccxml_definition,
global_annotations,
parameter_annotations):
- ns3_header = get_ns3_relative_path(pygccxml_definition.location.file_name)
+ try:
+ ns3_header = get_ns3_relative_path(pygccxml_definition.location.file_name)
+ except ValueError: # the header is not from ns3
+ return # ignore the definition, it's not ns-3 def.
+
definition_module = self.headers_map[ns3_header]
## Note: we don't include line numbers in the comments because
@@ -99,6 +106,7 @@
## classes
if isinstance(pygccxml_definition, class_t):
+ print >> sys.stderr, pygccxml_definition
# no need for helper classes to allow subclassing in Python, I think...
#if pygccxml_definition.name.endswith('Helper'):
# global_annotations['allow_subclassing'] = 'false'
@@ -114,8 +122,17 @@
template_parameters_decls = [find_declaration_from_name(module_parser.global_ns, templ_param)
for templ_param in template_parameters]
#print >> sys.stderr, "********************", cls_name, repr(template_parameters_decls)
- template_parameters_modules = [self.headers_map[get_ns3_relative_path(templ.location.file_name)]
- for templ in template_parameters_decls if hasattr(templ, 'location')]
+
+ template_parameters_modules = []
+ for templ in template_parameters_decls:
+ if not hasattr(templ, 'location'):
+ continue
+ try:
+ h = get_ns3_relative_path(templ.location.file_name)
+ except ValueError:
+ continue
+ template_parameters_modules.append(self.headers_map[h])
+
for templ_mod in template_parameters_modules:
if templ_mod == self.module:
definition_module = templ_mod
--- a/src/wscript Sun Mar 20 14:18:56 2011 +0000
+++ b/src/wscript Sun Mar 20 15:08:20 2011 +0000
@@ -170,7 +170,7 @@
if env['BINDINGS_TYPE'] not in ('modular', 'both'):
return
- if not bld.path.find_dir("bindings"):
+ if not os.path.exists(bld.path.find_dir("bindings").abspath()):
warnings.warn("(in %s) Requested to build modular python bindings, but apidefs dir not found "
"=> skipped the bindings." % str(bld.path),
Warning, stacklevel=2)