mirror of
https://github.com/niess/python-appimage.git
synced 2026-03-14 12:20:14 +01:00
Add install command & reorganize
This commit is contained in:
@@ -11,24 +11,34 @@ __all__ = ['main']
|
||||
def main():
|
||||
# Parse arguments
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Bundle a Python install into an AppImage')
|
||||
subparsers = parser.add_subparsers(title='builder',
|
||||
help='Appimage builder',
|
||||
dest='builder')
|
||||
prog='python-appimage',
|
||||
description='Bundle a Python installation into an AppImage')
|
||||
subparsers = parser.add_subparsers(title='command',
|
||||
help='Build or install command',
|
||||
dest='command')
|
||||
|
||||
parser.add_argument('-q', '--quiet', help='disable logging',
|
||||
dest='verbosity', action='store_const', const=logging.ERROR)
|
||||
parser.add_argument('-v', '--verbose', help='print extra information',
|
||||
dest='verbosity', action='store_const', const=logging.DEBUG)
|
||||
|
||||
local_parser = subparsers.add_parser('local')
|
||||
install_parser = subparsers.add_parser('install',
|
||||
description='Install binary dependencies')
|
||||
install_parser.add_argument('binary', nargs='+',
|
||||
choices=('appimagetool', 'patchelf'), help='one or more binary name')
|
||||
|
||||
local_parser = subparsers.add_parser('local',
|
||||
description='Bundle a local Python installation')
|
||||
local_parser.add_argument('-d', '--destination',
|
||||
help='AppImage destination')
|
||||
local_parser.add_argument('-p', '--python', help='python executable')
|
||||
|
||||
manylinux_parser = subparsers.add_parser('manylinux')
|
||||
manylinux_parser.add_argument('tag', help='manylinux image tag')
|
||||
manylinux_parser.add_argument('abi', help='python ABI')
|
||||
manylinux_parser = subparsers.add_parser('manylinux',
|
||||
description='Bundle a manylinux Python installation using docker')
|
||||
manylinux_parser.add_argument('tag',
|
||||
help='manylinux image tag (e.g. 2010_x86_64)')
|
||||
manylinux_parser.add_argument('abi',
|
||||
help='python ABI (e.g. cp37-cp37m)')
|
||||
|
||||
manylinux_parser.add_argument('--contained', help=argparse.SUPPRESS,
|
||||
action='store_true', default=False)
|
||||
@@ -39,9 +49,10 @@ def main():
|
||||
if args.verbosity:
|
||||
logging.getLogger().setLevel(args.verbosity)
|
||||
|
||||
# Call the AppImage builder
|
||||
builder = import_module('.builders.' + args.builder, package=__package__)
|
||||
builder.build(*builder._unpack_args(args))
|
||||
# Call the requested command
|
||||
command = import_module('.commands.' +
|
||||
args.command, package=__package__)
|
||||
command.execute(*command._unpack_args(args))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Reference in New Issue
Block a user