Fixing duplication of functions in the previous commit.
This commit is contained in:
parent
5d6c7f2df2
commit
8c4bc65184
|
@ -113,6 +113,7 @@ def build(arch, language, offline, portable, updatable, download_path, repo_path
|
|||
if not keep:
|
||||
shutil.rmtree(downloadpath)
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option("--verbose", '-v', is_flag=True, default=False, help="Show building phases.", show_default=True)
|
||||
@click.argument("yamlfile")
|
||||
|
@ -178,67 +179,6 @@ def batch(yamlfile, verbose):
|
|||
obj.remote_path = gvars['remote_path']
|
||||
obj.sign = gvars['sign']
|
||||
|
||||
|
||||
@cli.command()
|
||||
@click.option('-a', '--arch', 'arch', default='x86_64',
|
||||
type=click.Choice(['x86', 'x86_64', 'all'], case_sensitive=False), help="Build the AppImage for a specific architecture. Default: x86_64")
|
||||
@click.option('--check', '-c', is_flag=True, default=False, help="Checks in the repository path if the queried version is existent. Default: do not check")
|
||||
@click.option('--checksums', '-e', is_flag=True, default=False, help="Create checksums for each created file (AppImage). Default: do not create checksums.")
|
||||
@click.option('--keep-downloads', '-k', 'keep', is_flag=True, default=False, help="Keep the downloads folder after building the AppImage. Default: do not keep.")
|
||||
@click.option('--languages', '-l', '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('--offline-help', '-o', 'offline', is_flag=True, default=False, help="Include the offline help pages for the chosen languages. Default: no offline help")
|
||||
@click.option('--portable', '-p', 'portable', is_flag=True, default=False, help="Create a portable version of the AppImage or not. Default: no portable")
|
||||
@click.option('--sign', '-s', is_flag=True, default=False, help="Sign the build with your default GPG key. Default: do not sign")
|
||||
@click.option('--updatable', '-u', is_flag=True, default=False, help="Create an updatable AppImage (compatible with zsync2). Default: not updatable")
|
||||
@click.option('--download-path', '-d', default='./downloads', type=str, help="Path to the download folder. Default: ./downloads")
|
||||
@click.option('--repo-path', '-r', default='.', type=str, help="Path to the final storage of the AppImage. Default: current directory")
|
||||
@click.argument('query')
|
||||
def build(arch, language, offline, portable, updatable, download_path, repo_path, check, checksums, sign, keep, query):
|
||||
"""Builds an Appimage with the provided options."""
|
||||
|
||||
# Multiple query support
|
||||
queries = []
|
||||
if ',' in query:
|
||||
queries.extend(query.split(','))
|
||||
else:
|
||||
queries.append(query)
|
||||
|
||||
# Parsing options
|
||||
arches = []
|
||||
if arch.lower() == 'all':
|
||||
# We need to build it twice.
|
||||
arches = ['x86', 'x86_64']
|
||||
else:
|
||||
arches = [arch.lower()]
|
||||
|
||||
for myquery in queries:
|
||||
for appbuild in loaih.build.Collection(myquery, arches):
|
||||
# Configuration phase
|
||||
appbuild.tidy_folder = False
|
||||
appbuild.language = language
|
||||
appbuild.offline_help = offline
|
||||
appbuild.portable = portable
|
||||
appbuild.updatable = updatable
|
||||
appbuild.storage_path = os.path.abspath(repo_path)
|
||||
appbuild.download_path = os.path.abspath(download_path)
|
||||
appbuild.sign = sign
|
||||
|
||||
# Running phase
|
||||
appbuild.calculate()
|
||||
|
||||
if check:
|
||||
appbuild.check()
|
||||
|
||||
appbuild.download()
|
||||
appbuild.build()
|
||||
if checksums:
|
||||
appbuild.checksums()
|
||||
appbuild.publish()
|
||||
if not keep:
|
||||
shutil.rmtree(appbuild.download_path)
|
||||
|
||||
del appbuild
|
||||
|
||||
# Build phase
|
||||
obj.calculate()
|
||||
obj.check()
|
||||
|
|
Loading…
Reference in New Issue