From f0391a638bff558c95e528f5c9831df604219251 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Fri, 23 Feb 2018 15:24:47 +0100 Subject: [PATCH] Move projects' versions in a separated file. This way, versions can be imported by external scripts (ie travis) --- dependencies.py | 14 -------------- dependency_utils.py | 11 +++++++++-- dependency_versions.py | 21 +++++++++++++++++++++ 3 files changed, 30 insertions(+), 16 deletions(-) create mode 100644 dependency_versions.py diff --git a/dependencies.py b/dependencies.py index b29a698..66d9f05 100644 --- a/dependencies.py +++ b/dependencies.py @@ -31,7 +31,6 @@ from utils import Remotefile, pj, SkipCommand, copy_tree, add_execution_right class zlib(Dependency): name = 'zlib' - version = '1.2.8' class Source(ReleaseDownload): archive = Remotefile('zlib-1.2.8.tar.gz', @@ -78,7 +77,6 @@ class zlib(Dependency): class lzma(Dependency): name = 'lzma' - version = '5.0.4' class Source(ReleaseDownload): archive = Remotefile('xz-5.0.4.tar.bz2', @@ -91,7 +89,6 @@ class lzma(Dependency): class UUID(Dependency): name = 'uuid' - version = "1.43.4" class Source(ReleaseDownload): archive = Remotefile('e2fsprogs-libs-1.43.4.tar.gz', @@ -110,7 +107,6 @@ class UUID(Dependency): class Xapian(Dependency): name = "xapian-core" - version = "1.4.5" class Source(ReleaseDownload): archive = Remotefile('xapian-core-1.4.5.tar.xz', @@ -132,7 +128,6 @@ class Xapian(Dependency): class CTPP2(Dependency): name = "ctpp2" - version = "2.8.3" class Source(ReleaseDownload): name = "ctpp2" @@ -175,7 +170,6 @@ class CTPP2C(CTPP2): class Pugixml(Dependency): name = "pugixml" - version = "1.2" class Source(ReleaseDownload): archive = Remotefile('pugixml-1.2.tar.gz', @@ -187,7 +181,6 @@ class Pugixml(Dependency): class MicroHttpd(Dependency): name = "libmicrohttpd" - version = "0.9.46" class Source(ReleaseDownload): archive = Remotefile('libmicrohttpd-0.9.46.tar.gz', @@ -200,7 +193,6 @@ class MicroHttpd(Dependency): class Gumbo(Dependency): name = "gumbo" - version = "0.10.1" class Source(ReleaseDownload): archive = Remotefile('gumbo-0.10.1.tar.gz', @@ -217,7 +209,6 @@ class Gumbo(Dependency): class Icu(Dependency): name = "icu4c" - version = "58.2" class Source(SvnClone): name = "icu4c" @@ -279,7 +270,6 @@ class Libzim(Dependency): class Source(GitClone): git_remote = "https://github.com/openzim/libzim.git" git_dir = "libzim" - release_git_ref = "3.0.0" Builder = MesonBuilder @@ -291,7 +281,6 @@ class ZimTools(Dependency): class Source(GitClone): git_remote = "https://github.com/openzim/zim-tools.git" git_dir = "zim-tools" - release_git_ref = "0.0.1" class Builder(MesonBuilder): @property @@ -343,7 +332,6 @@ class Kiwixlib(Dependency): class Source(GitClone): git_remote = "https://github.com/kiwix/kiwix-lib.git" git_dir = "kiwix-lib" - release_git_ref = "1.0.2" class Builder(MesonBuilder): @property @@ -367,7 +355,6 @@ class KiwixTools(Dependency): class Source(GitClone): git_remote = "https://github.com/kiwix/kiwix-tools.git" git_dir = "kiwix-tools" - release_git_ref = "0.3.0" class Builder(MesonBuilder): @property @@ -379,7 +366,6 @@ class KiwixTools(Dependency): class Gradle(Dependency): name = "Gradle" - version = "3.4" class Source(ReleaseDownload): archive = Remotefile('gradle-4.1-bin.zip', diff --git a/dependency_utils.py b/dependency_utils.py index 5326bd4..53a18aa 100644 --- a/dependency_utils.py +++ b/dependency_utils.py @@ -3,6 +3,7 @@ import os import shutil from utils import pj, Context, SkipCommand, extract_archive, Defaultdict, StopBuild +from dependency_versions import main_project_versions, base_deps_versions SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) @@ -20,7 +21,6 @@ class Dependency(metaclass=_MetaDependency): all_deps = {} dependencies = [] force_native_build = False - version = None def __init__(self, buildEnv): self.buildEnv = buildEnv @@ -28,6 +28,10 @@ class Dependency(metaclass=_MetaDependency): self.builder = self.Builder(self) self.skip = False + @property + def version(self): + return base_deps_versions.get(self.name, None) + @property def full_name(self): if self.version: @@ -124,7 +128,10 @@ class ReleaseDownload(Source): class GitClone(Source): base_git_ref = "master" - release_git_ref = "master" + + @property + def release_git_ref(self): + return main_project_versions.get(self.name, "master") @property def source_dir(self): diff --git a/dependency_versions.py b/dependency_versions.py new file mode 100644 index 0000000..4283429 --- /dev/null +++ b/dependency_versions.py @@ -0,0 +1,21 @@ + +main_project_versions = { + 'kiwix-lib': '1.0.2', + 'kiwix-tools': '0.3.0', + 'libzim': '3.0.0', + 'zim-tools': '0.0.1', + 'zimwriterfs': '1.1', +} + +base_deps_versions = { + 'zlib' : '1.2.8', + 'lzma' : '5.0.4', + 'uuid' : '1.43.4', + 'xapian-core' : '1.4.5', + 'ctpp2' : '2.8.3', + 'pugixml' : '1.2', + 'libmicrohttpd' : '0.9.46', + 'gumbo' : '0.10.1', + 'icu4c' : '58.2', + 'Gradle' : '3.4', +}