mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-18 03:28:07 +00:00
30 lines
741 B
Python
Executable file
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())
|