def do_generate_interface(target, source, env): """Generate a .pyf file from another pyf file (!).""" # XXX: do this correctly target_name = str(target[0]) source_name = str(source[0]) # XXX handle skip names name = splitext(pbasename(target_name))[0] generate_interface(name, source_name, target_name) return 0
def generate_pyf(extension, build_dir): name = extension.name.split('.')[-1] target = join(build_dir, target_dir, name + '.pyf') if name[0] == 'c' and atlas_version is None and newer( __file__, target): f = open(target, 'w') f.write('python module ' + name + '\n') f.write('usercode void empty_module(void) {}\n') f.write('interface\n') f.write('subroutine empty_module()\n') f.write('intent(c) empty_module\n') f.write('end subroutine empty_module\n') f.write('end interface\nend python module' + name + '\n') f.close() return target if newer_group(extension.depends, target): generate_interface(name, extension.depends[0], target, skip_names[name]) return target
def generate_pyf(extension, build_dir): name = extension.name.split('.')[-1] target = join(build_dir,target_dir,name+'.pyf') if name[0]=='c' and atlas_version is None and newer(__file__,target): f = open(target,'w') f.write('python module '+name+'\n') f.write('usercode void empty_module(void) {}\n') f.write('interface\n') f.write('subroutine empty_module()\n') f.write('intent(c) empty_module\n') f.write('end subroutine empty_module\n') f.write('end interface\nend python module'+name+'\n') f.close() return target if newer_group(extension.depends,target): generate_interface(name, extension.depends[0], target, skip_names[name]) return target
def do_generate_fake_interface(target, source, env): """Generate a (fake) .pyf file from another pyf file (!).""" # XXX: do this correctly target_name = str(target[0]) source_name = str(source[0]) # XXX handle skip names name = splitext(pbasename(target_name))[0] generate_interface(name, source_name, target_name) f = open(target_name, 'w') f.write('python module '+name+'\n') f.write('usercode void empty_module(void) {}\n') f.write('interface\n') f.write('subroutine empty_module()\n') f.write('intent(c) empty_module\n') f.write('end subroutine empty_module\n') f.write('end interface\nend python module'+name+'\n') f.close() return 0
def run(self): node = self.inputs[0] output = self.outputs[0] module_name = f2py_modulename(node) generate_interface(module_name, node.abspath(), output.abspath()) return 0