Use dependency names as reference instead of class names.

Class names are implementation names.
Using the dependency names is better as it surprise less the user.
This commit is contained in:
Matthieu Gautier 2017-04-08 17:47:11 +02:00
parent 81796e7125
commit 308cfa6986
4 changed files with 31 additions and 24 deletions

View File

@ -18,12 +18,12 @@ env:
- BUILD_OPTION="--target-platform=native_static" ARCHIVE_TYPE="--tar" DEPLOY=true
- BUILD_OPTION="--target-platform=win32_dyn"
- BUILD_OPTION="--target-platform=win32_static" ARCHIVE_TYPE="--zip" DEPLOY=true
- BUILD_OPTION="--target-platform=android_arm Kiwixlib"
- BUILD_OPTION="--target-platform=android_arm64 Kiwixlib"
- BUILD_OPTION="--target-platform=android_mips Kiwixlib"
- BUILD_OPTION="--target-platform=android_mips64 Kiwixlib"
- BUILD_OPTION="--target-platform=android_x86 Kiwixlib"
- BUILD_OPTION="--target-platform=android_x86_64 Kiwixlib"
- BUILD_OPTION="--target-platform=android_arm kiwix-lib"
- BUILD_OPTION="--target-platform=android_arm64 kiwix-lib"
- BUILD_OPTION="--target-platform=android_mips kiwix-lib"
- BUILD_OPTION="--target-platform=android_mips64 kiwix-lib"
- BUILD_OPTION="--target-platform=android_x86 kiwix-lib"
- BUILD_OPTION="--target-platform=android_x86_64 kiwix-lib"
notifications:
irc:
channels:

View File

@ -123,7 +123,7 @@ class Xapian(Dependency):
deps = ['zlib', 'lzma']
if self.buildEnv.platform_info.build == 'win32':
return deps
return deps + ['UUID']
return deps + ['uuid']
class CTPP2(Dependency):
@ -175,6 +175,12 @@ class Icu(Dependency):
version = "58_2"
class Source(ReleaseDownload):
name = "icu4c"
@property
def source_dir(self):
return "{}-{}".format(self.name, self.target.version)
archive = Remotefile('icu4c-58_2-src.tgz',
'2b0a4410153a9b20de0e20c7d8b66049a72aef244b53683d0d7521371683da0c',
'https://freefr.dl.sourceforge.net/project/icu/ICU4C/58.2/icu4c-58_2-src.tgz')
@ -201,10 +207,10 @@ class Icu(Dependency):
class Icu_native(Icu):
name = "icu4c_native"
force_native_build = True
class Builder(Icu.Builder):
name = "icu_native"
@property
def build_path(self):
return super().build_path+"_native"
@ -214,14 +220,14 @@ class Icu_native(Icu):
class Icu_cross_compile(Icu):
dependencies = ['Icu_native']
name = "icu4c_cross-compile"
dependencies = ['icu4c_native']
class Builder(Icu.Builder):
name = "icu_cross-compile"
@property
def configure_option(self):
Icu_native = self.buildEnv.targetsDict['Icu_native']
return super().configure_option + " --with-cross-build=" + Icu_native.builder.build_path
icu_native_dep = self.buildEnv.targetsDict['icu4c_native']
return super().configure_option + " --with-cross-build=" + icu_native_dep.builder.build_path
class OpenzimSource(GitClone):
@ -234,8 +240,8 @@ class OpenzimSource(GitClone):
self.buildEnv.run_command(command, pj(self.git_path, 'zimwriterfs'), context)
class Zimlib(Dependency):
name = "zimlib"
class Libzim(Dependency):
name = "libzim"
Source = OpenzimSource
@ -249,11 +255,11 @@ class Zimwriterfs(Dependency):
@property
def dependencies(self):
base_dependencies = ['Zimlib', 'zlib', 'lzma', 'Xapian']
base_dependencies = ['libzim', 'zlib', 'lzma', 'xapian-core']
if self.buildEnv.platform_info.build != 'native':
return base_dependencies + ["Icu_cross_compile"]
return base_dependencies + ["icu4c_cross-compile"]
else:
return base_dependencies + ["Icu"]
return base_dependencies + ["icu4c"]
Source = OpenzimSource
@ -266,13 +272,13 @@ class Kiwixlib(Dependency):
@property
def dependencies(self):
base_dependencies = ["Xapian", "Pugixml", "Zimlib", "zlib", "lzma"]
base_dependencies = ["xapian-core", "pugixml", "libzim", "zlib", "lzma"]
if self.buildEnv.platform_info.build != 'android':
base_dependencies += ['CTPP2']
base_dependencies += ['ctpp2']
if self.buildEnv.platform_info.build != 'native':
return base_dependencies + ["Icu_cross_compile"]
return base_dependencies + ["icu4c_cross-compile"]
else:
return base_dependencies + ["Icu"]
return base_dependencies + ["icu4c"]
class Source(GitClone):
git_remote = "https://github.com/kiwix/kiwix-lib.git"
@ -295,7 +301,7 @@ class Kiwixlib(Dependency):
class KiwixTools(Dependency):
name = "kiwix-tools"
dependencies = ["Kiwixlib", "MicroHttpd", "zlib"]
dependencies = ["kiwix-lib", "libmicrohttpd", "zlib"]
class Source(GitClone):
git_remote = "https://github.com/kiwix/kiwix-tools.git"

View File

@ -11,7 +11,8 @@ class _MetaDependency(type):
def __new__(cls, name, bases, dct):
_class = type.__new__(cls, name, bases, dct)
if name != 'Dependency':
Dependency.all_deps[name] = _class
dep_name = dct['name']
Dependency.all_deps[dep_name] = _class
return _class

View File

@ -780,7 +780,7 @@ class Builder:
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('targets', default='KiwixTools', nargs='?')
parser.add_argument('targets', default='kiwix-tools', nargs='?')
parser.add_argument('--working-dir', default=".")
parser.add_argument('--libprefix', default=None)
parser.add_argument('--target-platform', default="native_dyn", choices=BuildEnv.target_platforms)