2018-09-20 16:49:50 +00:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
import argparse
|
|
|
|
|
|
|
|
from . import buildall
|
|
|
|
from . import buildpkg
|
|
|
|
from . import pywasmcross
|
2018-11-28 07:42:22 +00:00
|
|
|
from . import serve
|
2019-02-28 23:43:26 +00:00
|
|
|
from . import mkpkg
|
2018-09-20 16:49:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
2020-06-28 18:24:40 +00:00
|
|
|
main_parser = argparse.ArgumentParser(prog="pyodide")
|
|
|
|
subparsers = main_parser.add_subparsers(help="action")
|
2018-09-20 16:49:50 +00:00
|
|
|
|
2020-06-28 18:24:40 +00:00
|
|
|
for command_name, module in (
|
|
|
|
("buildpkg", buildpkg),
|
|
|
|
("buildall", buildall),
|
|
|
|
("pywasmcross", pywasmcross),
|
|
|
|
("serve", serve),
|
|
|
|
("mkpkg", mkpkg),
|
|
|
|
):
|
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()
|
2020-06-28 18:24:40 +00:00
|
|
|
if hasattr(args, "func"):
|
2019-01-15 15:09:09 +00:00
|
|
|
# run the selected action
|
|
|
|
args.func(args)
|
|
|
|
else:
|
|
|
|
main_parser.print_help()
|
2018-09-20 16:49:50 +00:00
|
|
|
|
|
|
|
|
2020-06-28 18:24:40 +00:00
|
|
|
if __name__ == "__main__":
|
2018-09-20 16:49:50 +00:00
|
|
|
main()
|