linphone-ios/tools/python/apixml2python.py
2014-07-07 11:22:06 +02:00

30 lines
741 B
Python
Executable file

#!/usr/bin/python
import argparse
import os
import pystache
import sys
import xml.etree.ElementTree as ET
sys.path.append(os.path.realpath(__file__))
from apixml2python.linphone import LinphoneModule
def generate(apixmlfile):
tree = ET.parse(apixmlfile)
renderer = pystache.Renderer()
m = LinphoneModule(tree)
f = open("linphone.c", "w")
f.write(renderer.render(m))
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('apixmlfile', help="XML file of the Linphone API generated by genapixml.py.")
args = argparser.parse_args()
generate(args.apixmlfile)
if __name__ == "__main__":
sys.exit(main())