mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-01-20 12:38:09 +00:00
Add an option to define the output file when generating the Python wrapper code.
This commit is contained in:
parent
ee60f5a10b
commit
fe76b2f4c0
1 changed files with 5 additions and 3 deletions
|
|
@ -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())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue