Refactoring di determinato codice, vediamo se potrebbe funzionare.
This commit is contained in:
parent
5ce7f5cc07
commit
c88e10b2ac
@ -8,6 +8,7 @@ import tempfile, os, sys, glob, subprocess, shutil, re
|
||||
class Build(object):
|
||||
LANGSTD = [ 'ar', 'de', 'en-GB', 'es', 'fr', 'it', 'ja', 'ko', 'pt', 'pt-BR', 'ru', 'zh-CN', 'zh-TW' ]
|
||||
LANGBASIC = [ 'en-GB' ]
|
||||
ARCHSTD = [ u'x86', u'x86_64' ]
|
||||
|
||||
def __init__(self, query, arch):
|
||||
"""Build all versions that can be found in the indicated repo."""
|
||||
@ -35,7 +36,7 @@ class Build(object):
|
||||
self.appname = 'LibreOffice' if not self.query == 'daily' and not self.query == 'prerelease' else 'LibreOfficeDev'
|
||||
self.version = v.version
|
||||
self.url = v.basedirurl
|
||||
self.built = { 'x86': False, 'x86_64': False }
|
||||
self.built = { u'x86': False, u'x86_64': False }
|
||||
|
||||
# Preparing the default for the relative path on the storage for
|
||||
# different versions.
|
||||
@ -73,12 +74,10 @@ class Build(object):
|
||||
# If the build was called by queried name, build from latest release available but build with the most generic name
|
||||
myver = str.join('.', self.version.split('.')[0:2])
|
||||
self.genappversion = myver + self.languagepart + self.helppart
|
||||
self.genappimagefilename['x86'] = self.appname + '-' + self.genappversion + '-x86.AppImage'
|
||||
self.genappimagefilename['x86_64'] = self.appname + '-' + self.genappversion + '-x86_64.AppImage'
|
||||
|
||||
self.appversion = self.version + self.languagepart + self.helppart
|
||||
self.appimagefilename['x86'] = self.appname + '-' + self.appversion + '-x86.AppImage'
|
||||
self.appimagefilename['x86_64'] = self.appname + '-' + self.appversion + '-x86_64.AppImage'
|
||||
for arch in ARCHSTD:
|
||||
self.genappimagefilename[arch] = self.appname + '-' + self.genappversion + f'-{arch}.AppImage'
|
||||
self.appimagefilename[arch] = self.appname + '-' + self.appversion + f'-{arch}.AppImage'
|
||||
|
||||
for arch in self.arch:
|
||||
# For generalized builds, we need to check if there are .ver file
|
||||
|
@ -2,7 +2,6 @@
|
||||
# encoding: utf-8
|
||||
|
||||
import click
|
||||
import yaml
|
||||
import loaih
|
||||
|
||||
@click.command()
|
||||
@ -21,39 +20,10 @@ def build(arch, language, offline, portable, updatable, download_path, repo_path
|
||||
arches = []
|
||||
if arch.lower() == 'all':
|
||||
# We need to build it twice.
|
||||
arches = [ 'x86', 'x86_64' ]
|
||||
arches = [ u'x86', u'x86_64' ]
|
||||
else:
|
||||
arches = [ arch.lower().decode('utf-8') ]
|
||||
arches = [ arch.lower() ]
|
||||
|
||||
if query.endswith('.yml') or query.endswith('.yaml'):
|
||||
# This is a buildfile. So we have to load the file and pass the build options ourselves.
|
||||
config = {}
|
||||
with open(query, 'r') as file:
|
||||
config = yaml.safe_load(file)
|
||||
|
||||
# With the config file, we ignore all the command line options and set
|
||||
# generic default.
|
||||
for build in config['builds']:
|
||||
# Loop a run for each build.
|
||||
obj = loaih.Build(build['query'], arches)
|
||||
|
||||
obj.language = build['language']
|
||||
obj.offline_help = build['offline_help']
|
||||
obj.portable = build['portable']
|
||||
obj.updatable = True
|
||||
|
||||
if check:
|
||||
obj.check(config['data']['storage'])
|
||||
else:
|
||||
obj.storage_path = config['data']['storage']
|
||||
|
||||
obj.download(config['data']['download'])
|
||||
obj.build()
|
||||
obj.checksums()
|
||||
obj.publish()
|
||||
del obj
|
||||
|
||||
else:
|
||||
obj = loaih.Build(query, arches)
|
||||
|
||||
obj.language = language
|
||||
|
Reference in New Issue
Block a user