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):
|
class Build(object):
|
||||||
LANGSTD = [ 'ar', 'de', 'en-GB', 'es', 'fr', 'it', 'ja', 'ko', 'pt', 'pt-BR', 'ru', 'zh-CN', 'zh-TW' ]
|
LANGSTD = [ 'ar', 'de', 'en-GB', 'es', 'fr', 'it', 'ja', 'ko', 'pt', 'pt-BR', 'ru', 'zh-CN', 'zh-TW' ]
|
||||||
LANGBASIC = [ 'en-GB' ]
|
LANGBASIC = [ 'en-GB' ]
|
||||||
|
ARCHSTD = [ u'x86', u'x86_64' ]
|
||||||
|
|
||||||
def __init__(self, query, arch):
|
def __init__(self, query, arch):
|
||||||
"""Build all versions that can be found in the indicated repo."""
|
"""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.appname = 'LibreOffice' if not self.query == 'daily' and not self.query == 'prerelease' else 'LibreOfficeDev'
|
||||||
self.version = v.version
|
self.version = v.version
|
||||||
self.url = v.basedirurl
|
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
|
# Preparing the default for the relative path on the storage for
|
||||||
# different versions.
|
# 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
|
# 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])
|
myver = str.join('.', self.version.split('.')[0:2])
|
||||||
self.genappversion = myver + self.languagepart + self.helppart
|
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.appversion = self.version + self.languagepart + self.helppart
|
||||||
self.appimagefilename['x86'] = self.appname + '-' + self.appversion + '-x86.AppImage'
|
for arch in ARCHSTD:
|
||||||
self.appimagefilename['x86_64'] = self.appname + '-' + self.appversion + '-x86_64.AppImage'
|
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 arch in self.arch:
|
||||||
# For generalized builds, we need to check if there are .ver file
|
# For generalized builds, we need to check if there are .ver file
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
# encoding: utf-8
|
# encoding: utf-8
|
||||||
|
|
||||||
import click
|
import click
|
||||||
import yaml
|
|
||||||
import loaih
|
import loaih
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
@ -21,56 +20,27 @@ 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 = [ u'x86', u'x86_64' ]
|
||||||
else:
|
else:
|
||||||
arches = [ arch.lower().decode('utf-8') ]
|
arches = [ arch.lower() ]
|
||||||
|
|
||||||
if query.endswith('.yml') or query.endswith('.yaml'):
|
obj = loaih.Build(query, arches)
|
||||||
# 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
|
obj.language = language
|
||||||
# generic default.
|
obj.offline_help = offline
|
||||||
for build in config['builds']:
|
obj.portable = portable
|
||||||
# Loop a run for each build.
|
obj.updatable = updatable
|
||||||
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
|
|
||||||
|
|
||||||
|
if check:
|
||||||
|
obj.check(repo_path)
|
||||||
else:
|
else:
|
||||||
obj = loaih.Build(query, arches)
|
obj.storage_path = repo_path
|
||||||
|
|
||||||
obj.language = language
|
obj.download(download_path)
|
||||||
obj.offline_help = offline
|
obj.build()
|
||||||
obj.portable = portable
|
obj.checksums()
|
||||||
obj.updatable = updatable
|
obj.publish()
|
||||||
|
del obj
|
||||||
if check:
|
|
||||||
obj.check(repo_path)
|
|
||||||
else:
|
|
||||||
obj.storage_path = repo_path
|
|
||||||
|
|
||||||
obj.download(download_path)
|
|
||||||
obj.build()
|
|
||||||
obj.checksums()
|
|
||||||
obj.publish()
|
|
||||||
del obj
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
build()
|
build()
|
||||||
|
Reference in New Issue
Block a user