Removing unmet dependency.
This commit is contained in:
parent
3dbfef9fbe
commit
2277523f3c
|
@ -8,14 +8,15 @@ import sys
|
||||||
import json
|
import json
|
||||||
import click
|
import click
|
||||||
import yaml
|
import yaml
|
||||||
from dotmap import DotMap
|
|
||||||
import loaih
|
import loaih
|
||||||
import loaih.build
|
import loaih.build
|
||||||
|
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
def cli():
|
def cli():
|
||||||
"""Helps with command line commands."""
|
"""Helps with command line commands."""
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
@click.option('-j', '--json', 'jsonout', default=False, is_flag=True, help="Output format in json.")
|
@click.option('-j', '--json', 'jsonout', default=False, is_flag=True, help="Output format in json.")
|
||||||
@click.option('--default-to-current', '-d', is_flag=True, default=False, help="If no versions are found, default to current one (for daily builds). Default: do not default to current.")
|
@click.option('--default-to-current', '-d', is_flag=True, default=False, help="If no versions are found, default to current one (for daily builds). Default: do not default to current.")
|
||||||
|
@ -42,6 +43,7 @@ def getversion(query, jsonout, default_to_current):
|
||||||
for value in batchlist:
|
for value in batchlist:
|
||||||
click.echo(value)
|
click.echo(value)
|
||||||
|
|
||||||
|
|
||||||
@cli.command()
|
@cli.command()
|
||||||
@click.option("--verbose", '-v', is_flag=True, default=False, help="Show building phases.", show_default=True)
|
@click.option("--verbose", '-v', is_flag=True, default=False, help="Show building phases.", show_default=True)
|
||||||
@click.argument("yamlfile")
|
@click.argument("yamlfile")
|
||||||
|
@ -56,33 +58,36 @@ def batch(yamlfile, verbose):
|
||||||
click.echo(f"YAML file {yamlfile} does not exists or is unreadable.")
|
click.echo(f"YAML file {yamlfile} does not exists or is unreadable.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# This is a buildfile. So we have to load the file and pass the build options ourselves.
|
# This is a buildfile. So we have to load the file and pass the build
|
||||||
|
# options ourselves.
|
||||||
config = {}
|
config = {}
|
||||||
with open(os.path.abspath(yamlfile), 'r', encoding='utf-8') as file:
|
with open(os.path.abspath(yamlfile), 'r', encoding='utf-8') as file:
|
||||||
config = yaml.safe_load(file)
|
config = yaml.safe_load(file)
|
||||||
|
|
||||||
# Globals for yamlfile
|
# Globals for yamlfile
|
||||||
gvars = DotMap()
|
gvars = {}
|
||||||
gvars.storage_path = "/srv/http/appimage.sys42.eu"
|
gvars['storage_path'] = "/srv/http/appimage.sys42.eu"
|
||||||
if 'repo' in config['data'] and config['data']['repo']:
|
if 'repo' in config['data'] and config['data']['repo']:
|
||||||
gvars.storage_path = config['data']['repo']
|
gvars['storage_path'] = config['data']['repo']
|
||||||
|
|
||||||
gvars.download_path = "/var/tmp/downloads"
|
gvars['download_path'] = "/var/tmp/downloads"
|
||||||
if 'download' in config['data'] and config['data']['download']:
|
if 'download' in config['data'] and config['data']['download']:
|
||||||
gvars.download_path = config['data']['download']
|
gvars['download_path'] = config['data']['download']
|
||||||
|
|
||||||
if 'http' in gvars.storage_path:
|
gvars['remoterepo'] = False
|
||||||
gvars.remoterepo = True
|
gvars['remote_host'] = ''
|
||||||
gvars.remote_host = "ciccio.libreitalia.org"
|
gvars['remote_path'] = "/var/lib/nethserver/vhost/appimages"
|
||||||
|
if 'http' in gvars['storage_path']:
|
||||||
|
gvars['remoterepo'] = True
|
||||||
|
gvars['remote_host'] = "ciccio.libreitalia.org"
|
||||||
if 'remote_host' in config['data'] and config['data']['remote_host']:
|
if 'remote_host' in config['data'] and config['data']['remote_host']:
|
||||||
gvars.remote_host = config['data']['remote_host']
|
gvars['remote_host'] = config['data']['remote_host']
|
||||||
|
|
||||||
gvars.remote_path = "/var/lib/nethserver/vhost/appimages"
|
|
||||||
if 'remote_path' in config['data'] and config['data']['remote_path']:
|
if 'remote_path' in config['data'] and config['data']['remote_path']:
|
||||||
gvars.remote_path = config['data']['remote_path']
|
gvars['remote_path'] = config['data']['remote_path']
|
||||||
|
|
||||||
if 'sign' in config['data'] and config['data']['sign']:
|
if 'sign' in config['data'] and config['data']['sign']:
|
||||||
gvars.sign = True
|
gvars['sign'] = True
|
||||||
|
|
||||||
# With the config file, we ignore all the command line options and set
|
# With the config file, we ignore all the command line options and set
|
||||||
# generic default.
|
# generic default.
|
||||||
|
@ -106,12 +111,12 @@ def batch(yamlfile, verbose):
|
||||||
obj.offline_help = cbuild['offline_help']
|
obj.offline_help = cbuild['offline_help']
|
||||||
obj.portable = cbuild['portable']
|
obj.portable = cbuild['portable']
|
||||||
obj.updatable = True
|
obj.updatable = True
|
||||||
obj.storage_path = gvars.storage_path
|
obj.storage_path = gvars['storage_path']
|
||||||
obj.download_path = gvars.download_path
|
obj.download_path = gvars['download_path']
|
||||||
obj.remoterepo = gvars.remoterepo
|
obj.remoterepo = gvars['remoterepo']
|
||||||
obj.remote_host = gvars.remote_host
|
obj.remote_host = gvars['remote_host']
|
||||||
obj.remote_path = gvars.remote_path
|
obj.remote_path = gvars['remote_path']
|
||||||
obj.sign = gvars.sign
|
obj.sign = gvars['sign']
|
||||||
|
|
||||||
# Build phase
|
# Build phase
|
||||||
obj.calculate()
|
obj.calculate()
|
||||||
|
@ -133,13 +138,13 @@ def batch(yamlfile, verbose):
|
||||||
@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('--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('--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('--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('--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('--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('--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('--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('--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('--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.option('--repo-path', '-r', default='.', type=str, help="Path to the final storage of the AppImage. Default: current directory")
|
||||||
@click.argument('query')
|
@click.argument('query')
|
||||||
def build(arch, language, offline, portable, updatable, download_path, repo_path, check, checksums, sign, keep, query):
|
def build(arch, language, offline, portable, updatable, download_path, repo_path, check, checksums, sign, keep, query):
|
||||||
"""Builds an Appimage with the provided options."""
|
"""Builds an Appimage with the provided options."""
|
||||||
|
@ -155,9 +160,9 @@ def build(arch, language, offline, portable, updatable, download_path, repo_path
|
||||||
arches = []
|
arches = []
|
||||||
if arch.lower() == 'all':
|
if arch.lower() == 'all':
|
||||||
# We need to build it twice.
|
# We need to build it twice.
|
||||||
arches = [ 'x86', 'x86_64' ]
|
arches = ['x86', 'x86_64']
|
||||||
else:
|
else:
|
||||||
arches = [ arch.lower() ]
|
arches = [arch.lower()]
|
||||||
|
|
||||||
for myquery in queries:
|
for myquery in queries:
|
||||||
for appbuild in loaih.build.Collection(myquery, arches):
|
for appbuild in loaih.build.Collection(myquery, arches):
|
||||||
|
|
Loading…
Reference in New Issue