Commit fe76b2f4 authored by Ghislain MARY's avatar Ghislain MARY
Browse files

Add an option to define the output file when generating the Python wrapper code.

parent ee60f5a1
......@@ -118,11 +118,10 @@ hand_written_functions = [
'linphone_core_new_with_config'
]
def generate(apixmlfile):
def generate(apixmlfile, f):
tree = ET.parse(apixmlfile)
renderer = pystache.Renderer()
m = LinphoneModule(tree, blacklisted_classes, blacklisted_events, blacklisted_functions, hand_written_functions)
f = open("linphone.c", "w")
os.chdir('apixml2python')
f.write(renderer.render(m))
......@@ -131,9 +130,12 @@ def main(argv = None):
if argv is None:
argv = sys.argv
argparser = argparse.ArgumentParser(description="Generate a Python wrapper of the Linphone API.")
argparser.add_argument('-o', '--outputfile', metavar='outputfile', type=argparse.FileType('w'), help="Output C file containing the code of the Python wrapper.")
argparser.add_argument('apixmlfile', help="XML file of the Linphone API generated by genapixml.py.")
args = argparser.parse_args()
generate(args.apixmlfile)
if args.outputfile == None:
args.outputfile = open('linphone.c', 'w')
generate(args.apixmlfile, args.outputfile)
if __name__ == "__main__":
sys.exit(main())
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment