1111def main ():
1212 # Parse arguments
1313 parser = argparse .ArgumentParser (
14- description = 'Bundle a Python install into an AppImage' )
15- subparsers = parser .add_subparsers (title = 'builder' ,
16- help = 'Appimage builder' ,
17- dest = 'builder' )
14+ prog = 'python-appimage' ,
15+ description = 'Bundle a Python installation into an AppImage' )
16+ subparsers = parser .add_subparsers (title = 'command' ,
17+ help = 'Build or install command' ,
18+ dest = 'command' )
1819
1920 parser .add_argument ('-q' , '--quiet' , help = 'disable logging' ,
2021 dest = 'verbosity' , action = 'store_const' , const = logging .ERROR )
2122 parser .add_argument ('-v' , '--verbose' , help = 'print extra information' ,
2223 dest = 'verbosity' , action = 'store_const' , const = logging .DEBUG )
2324
24- local_parser = subparsers .add_parser ('local' )
25+ install_parser = subparsers .add_parser ('install' ,
26+ description = 'Install binary dependencies' )
27+ install_parser .add_argument ('binary' , nargs = '+' ,
28+ choices = ('appimagetool' , 'patchelf' ), help = 'one or more binary name' )
29+
30+ local_parser = subparsers .add_parser ('local' ,
31+ description = 'Bundle a local Python installation' )
2532 local_parser .add_argument ('-d' , '--destination' ,
2633 help = 'AppImage destination' )
2734 local_parser .add_argument ('-p' , '--python' , help = 'python executable' )
2835
29- manylinux_parser = subparsers .add_parser ('manylinux' )
30- manylinux_parser .add_argument ('tag' , help = 'manylinux image tag' )
31- manylinux_parser .add_argument ('abi' , help = 'python ABI' )
36+ manylinux_parser = subparsers .add_parser ('manylinux' ,
37+ description = 'Bundle a manylinux Python installation using docker' )
38+ manylinux_parser .add_argument ('tag' ,
39+ help = 'manylinux image tag (e.g. 2010_x86_64)' )
40+ manylinux_parser .add_argument ('abi' ,
41+ help = 'python ABI (e.g. cp37-cp37m)' )
3242
3343 manylinux_parser .add_argument ('--contained' , help = argparse .SUPPRESS ,
3444 action = 'store_true' , default = False )
@@ -39,9 +49,10 @@ def main():
3949 if args .verbosity :
4050 logging .getLogger ().setLevel (args .verbosity )
4151
42- # Call the AppImage builder
43- builder = import_module ('.builders.' + args .builder , package = __package__ )
44- builder .build (* builder ._unpack_args (args ))
52+ # Call the requested command
53+ command = import_module ('.commands.' +
54+ args .command , package = __package__ )
55+ command .execute (* command ._unpack_args (args ))
4556
4657
4758if __name__ == "__main__" :
0 commit comments