medit/api/genlua.py

24 lines
624 B
Python
Raw Normal View History

2010-12-11 01:06:28 -08:00
#! /usr/bin/env python
import sys
2010-12-12 02:29:20 -08:00
import optparse
2010-12-11 01:06:28 -08:00
from mpi.module import Module
from mpi.luawriter import Writer
2010-12-12 02:29:20 -08:00
op = optparse.OptionParser()
op.add_option("-i", "--import", action="append", dest="import_modules")
op.add_option("--include-header", action="append", dest="include_headers")
(opts, args) = op.parse_args()
import_modules = []
if opts.import_modules:
for filename in opts.import_modules:
import_modules.append(Module.from_xml(filename))
assert len(args) == 1
mod = Module.from_xml(args[0])
for im in import_modules:
mod.import_module(im)
Writer(sys.stdout).write(mod, opts.include_headers)