loaih/scripts/loaih-build

45 lines
2.2 KiB
Plaintext
Raw Normal View History

2022-03-20 22:57:45 +00:00
#!/usr/bin/env python
# encoding: utf-8
import click
import loaih
@click.command()
@click.option('-a', '--arch', 'arch', type=click.Choice(['x86', 'x86_64', 'all'], case_sensitive=False), default='all', help="Build the AppImage for a specific architecture. If there is no specific options, the process will build for both architectures (if available). Default: all")
@click.option('-l', '--language', 'language', default = 'basic', type=str, help="Languages to be included. Options: basic, standard, full, a language string (e.g. 'it') or a list of languages comma separated (e.g.: 'en-US,en-GB,it'). Default: basic")
@click.option('-o/-O', '--offline-help/--no-offline-help', 'offline', default = False, help="Include or not the offline help for the chosen languages. Default: no offline help")
@click.option('-p/-P', '--portable/--no-portable', 'portable', default = False, help="Create a portable version of the AppImage or not. Default: no portable")
@click.option('-u/-U', '--updatable/--no-updatable', 'updatable', default = True, help="Create an updatable version of the AppImage or not. Default: updatable")
@click.option('-d', '--download-path', 'download', default = '/var/tmp/downloads', type=str, help="Path to the download folder. Default: /var/tmp/downloads")
@click.option('-s', '--storage-path', 'storage', default = '/srv/http/appimage.sys42.eu', type=str, help="Path to the final storage of the AppImage. Default: /srv/http/appimage.sys42.eu")
@click.option('-c/-C', '--check/--no-check', 'check', default=True, help="Check in the final storage if the queried version is existent. Default: check")
@click.argument('query')
def build(arch, language, offline, portable, updatable, download, storage, check, query):
# Parsing options
if arch.lower() == 'all':
# We need to build it twice.
arches = [ u'x86', u'x86_64' ]
2022-03-20 22:57:45 +00:00
else:
arches = [ arch.lower().decode('utf-8') ]
2022-03-20 22:57:45 +00:00
obj = loaih.Build(query, arches)
2022-03-20 22:57:45 +00:00
obj.language = language
obj.offline_help = offline
obj.portable = portable
obj.updatable = updatable
2022-03-20 22:57:45 +00:00
if check:
obj.check(storage)
else:
obj.storage_path = storage
2022-03-20 23:38:07 +00:00
obj.download(download)
obj.build()
obj.checksums()
obj.move()
del obj
2022-03-20 22:57:45 +00:00
if __name__ == '__main__':
build()