def load_module(module, parent): print "Processing module `%s'" % module['name'] mod = SubModule(module['name'], parent) for enum in module['enums']: print " - enum `%s'" % enum['name'] mod.add_enum(enum['name'], enum['entries']) overrided = [] for func in module['functions']: name = func['name']['name'] custom_name = name.replace('ta_%s_' % mod.name, '') func['name']['pyname'] = custom_name # Adding method to a different list. This list holds methods # that are not generated by pybindgen. get_overrided = OVERRIDES.get(name) if get_overrided == '': # this empty string means that we have overrided the # method aiming to do not generate it continue elif get_overrided: # This means that a valid override was found. func['override'] = get_overrided overrided.append(func) continue try: mod.add_function(name, retval(func['rtype'], caller_owns_return=True), handle_params(func, parent), custom_name=custom_name) except Exception, e: warnings.warn('Skipping func %s, something wrong happened. %s' % (name, str(e)))
# policy, so the default is to do not have a destructor. We # use the generic one, ta_object_unref. destructor = None overrided = [] # Separating constructor, destructor and other ordinary # methods. for method in ktype['methods']: print " * method `%s'" % method['name']['name'] cname = '%(class)s_%(name)s' % method['name'] method['cname'] = cname # Adding method to a different list. This list holds # methods that are not generated by pybindgen. get_overrided = OVERRIDES.get(cname) if get_overrided == '': # this empty string means that we have overrided the # method aiming to do not generate it continue if get_overrided: # This means that a valid override was found. method['override'] = get_overrided overrided.append(method) continue # C API specific stuff. We don't have to expose it. if method['type']['name'] == 'initializer': continue