From 0b9390809dc782b460881df9e744392e9fdf9233 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 5 Dec 2025 22:40:34 +0100 Subject: [PATCH] Fix download and extraction of NINJA_SYNTAX * With this Dockerfile: FROM oraclelinux:10 RUN dnf install git COPY . /mx ENV PATH=/mx:$PATH WORKDIR /mx RUN mx version RUN ls -la ~/.mx/cache/NINJA_SYNTAX* RUN ls -la ~/.mx/cache/NINJA_SYNTAX*/* RUN ls -la ~/.mx/cache/NINJA_SYNTAX*/*/* RUN mx path --download NINJA_SYNTAX RUN ls -la ~/.mx/cache/NINJA_SYNTAX* RUN ls -la ~/.mx/cache/NINJA_SYNTAX*/*/* * Before this commit it's clear that ~/.mx/cache/NINJA_SYNTAX*/*/* is empty and remains empty even after `mx path --download NINJA_SYNTAX`. * After this commit, NINJA_SYNTAX is downloaded as soon as NinjaProject.resolveDeps is called. --- src/mx/_impl/mx_native.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mx/_impl/mx_native.py b/src/mx/_impl/mx_native.py index 92aa630c..1008cc5f 100644 --- a/src/mx/_impl/mx_native.py +++ b/src/mx/_impl/mx_native.py @@ -683,8 +683,8 @@ def _ninja_deps(cls): # pylint: disable=no-self-argument except ImportError: dep = mx.library('NINJA_SYNTAX') deps.append(dep) - module_path = os.path.join(dep.get_path(False), f'ninja_syntax-{dep.version}') - mx_util.ensure_dir_exists(module_path) # otherwise, import machinery will ignore it + module_path = os.path.join(dep.get_path(True), f'ninja_syntax-{dep.version}') + # note that the import machinery needs this path to exist now, otherwise it will be ignored sys.path.append(module_path) return deps