def generate(apixmlfile, outputfile): tree = ET.parse(apixmlfile) renderer = pystache.Renderer() m = LinphoneModule(tree, blacklisted_classes, blacklisted_events, blacklisted_functions, hand_written_functions) os.chdir('apixml2python') tmpfilename = outputfile.name + '.tmp' with open(tmpfilename, mode='w') as f: f.write(renderer.render(m)) with open(tmpfilename, mode='rU') as f: for line in f: if not line.isspace(): outputfile.write(line) os.unlink(tmpfilename)
def generate(apixmlfile, outputfile): tree = ET.parse(apixmlfile) renderer = pystache.Renderer() m = LinphoneModule(tree, blacklisted_classes, blacklisted_events, blacklisted_functions, hand_written_functions) os.chdir('apixml2python') tmpfilename = outputfile.name + '.tmp' f = open(tmpfilename, 'w') f.write(renderer.render(m)) f.close() f = open(tmpfilename, 'rU') for line in f: outputfile.write(line) f.close() os.unlink(tmpfilename)