From 9235f8b04849dd557dc49c7a048eb8964497031e Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Thu, 11 Apr 2024 17:05:45 +0200 Subject: [PATCH] Do not expect a full working environment when only asking for build dir. Job `Trigger_Docker` is run in a simple environment not configured. So tools as `ninja` are not installed. But we don't care as we just want to trigger a docker build. But `common` script now start by asking kiwix-build the build dir. kiwix-build must not fail in this case. --- kiwixbuild/__init__.py | 2 +- kiwixbuild/buildenv.py | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/kiwixbuild/__init__.py b/kiwixbuild/__init__.py index 8e5f645..03b2298 100644 --- a/kiwixbuild/__init__.py +++ b/kiwixbuild/__init__.py @@ -154,7 +154,7 @@ def main(): options = parse_args() options.working_dir = os.path.abspath(options.working_dir) _global.set_options(options) - neutralEnv = buildenv.NeutralEnv() + neutralEnv = buildenv.NeutralEnv(options.get_build_dir) _global.set_neutralEnv(neutralEnv) if options.config == "flatpak": builder = FlatpakBuilder() diff --git a/kiwixbuild/buildenv.py b/kiwixbuild/buildenv.py index 1f9f98d..8e766dc 100644 --- a/kiwixbuild/buildenv.py +++ b/kiwixbuild/buildenv.py @@ -8,7 +8,7 @@ from ._global import neutralEnv, option class NeutralEnv: - def __init__(self): + def __init__(self, dummy_run): self.working_dir = option("working_dir") self.source_dir = pj(self.working_dir, "SOURCE") self.archive_dir = pj(self.working_dir, "ARCHIVE") @@ -17,6 +17,10 @@ class NeutralEnv: for d in (self.source_dir, self.archive_dir, self.toolchain_dir, self.log_dir): os.makedirs(d, exist_ok=True) self.detect_platform() + if dummy_run: + # If this is for a dummy run, we will not run anything. + # To check for command (and so, don't enforce their presence) + return self.ninja_command = self._detect_command( "ninja", default=[["ninja"], ["ninja-build"]] )