[pygccxml-development] Multiple namespaces with the same name
Brought to you by:
mbaas,
roman_yakovenko
From: Vincent F. <vin...@gm...> - 2008-06-12 08:11:20
|
I'm renaming most of my classes to avoid them to override themselves like explained in an other subject. In order to achieve this I coded following functions which prefix the classes in python with their namespace names. rename_in_namespace(mb, ['nastran', 'samcef', 'generic', 'cla']) #Writing code to file. mb.split_module(settings.generated_files_dir) def rename_in_namespace(mb, nameList): for namespaceName in nameList: nspace = mb.global_ns.namespace(namespaceName) for clz in nspace.classes(): clz.rename(namespaceName.capitalize() + clz.name.capitalize()) There isn't apparently any way to get the name of the namespace the class is in, but it's not right here the problem, I know their names explicitely. When I try to generate the wrapper code, I'm encountering following errors : Traceback (most recent call last): File "generate_code.py", line 73, in ? export() File "generate_code.py", line 59, in export rename_in_namespace(mb, ['nastran', 'samcef', 'generic', 'cla']) File "generate_code.py", line 67, in rename_in_namespace nspace = mb.global_ns.namespace(namespaceName) File "/usr/lib/python2.4/site-packages/pygccxml/declarations/namespace.py", line 74, in namespace , recursive=recursive ) File "/usr/lib/python2.4/site-packages/pygccxml/declarations/scopedef.py", line 343, in _find_single found = matcher_module.matcher.get_single( matcher, decls, False ) File "/usr/lib/python2.4/site-packages/pygccxml/declarations/matcher.py", line 81, in get_single raise matcher.multiple_declarations_found_t( decl_matcher ) pygccxml.declarations.matcher.multiple_declarations_found_t: Multiple declarations has been found. matcher: [(decl type==namespace_t) and (name==nastran)] Even if the same namespace is defined many times, the delarations should complete themselves, not redefine each other right? Why do I have this error? |