pyodide/pyodide_build/__main__.py

28 lines
739 B
Python
Raw Normal View History

2018-09-20 16:49:50 +00:00
#!/usr/bin/env python3
import argparse
from . import buildall
from . import buildpkg
from . import pywasmcross
from . import serve
2018-09-20 16:49:50 +00:00
def main():
2018-09-21 14:58:09 +00:00
main_parser = argparse.ArgumentParser(prog='pyodide')
2018-09-20 16:49:50 +00:00
subparsers = main_parser.add_subparsers(help='action')
for command_name, module in (("buildpkg", buildpkg),
("buildall", buildall),
("pywasmcross", pywasmcross),
("serve", serve)):
2018-09-20 16:49:50 +00:00
parser = module.make_parser(subparsers.add_parser(command_name))
parser.set_defaults(func=module.main)
args = main_parser.parse_args()
# run the selected action
args.func(args)
if __name__ == '__main__':
main()