From 5bc4f6935e1ad7acec1f80a22a37d04f62fc6611 Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Tue, 30 Apr 2024 16:26:38 +0200 Subject: [PATCH] fix compile cl --- kiwixbuild/dependencies/xapian.py | 6 +++--- kiwixbuild/utils.py | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/kiwixbuild/dependencies/xapian.py b/kiwixbuild/dependencies/xapian.py index 3b2707b..70b5c78 100644 --- a/kiwixbuild/dependencies/xapian.py +++ b/kiwixbuild/dependencies/xapian.py @@ -1,6 +1,6 @@ from .base import Dependency, ReleaseDownload, MakeBuilder -from kiwixbuild.utils import Remotefile +from kiwixbuild.utils import Remotefile, win_to_posix_path from kiwixbuild._global import neutralEnv @@ -17,9 +17,9 @@ class Xapian(Dependency): @property def configure_options(self): if neutralEnv("distname") == "Windows": - compile_script = self.source_path / "compile" + compile_script = win_to_posix_path(self.source_path / "compile") return [ - 'CC="cl -nologo"', + f'CC="{compile_script} cl -nologo"', f'CXX="{compile_script} cl -nologo"', "CXXFLAGS=-EHsc", "AR=lib", diff --git a/kiwixbuild/utils.py b/kiwixbuild/utils.py index 8c9ee76..1911457 100644 --- a/kiwixbuild/utils.py +++ b/kiwixbuild/utils.py @@ -322,15 +322,19 @@ def extract_archive(archive_path: Path, dest_dir: Path, topdir=None, name=None): archive.close() +def win_to_posix_path(p: Path or str) -> str: + if isinstance(p, Path): + return str(PurePosixPath(p)).replace("C:/", "/c/") + return p + + def run_command(command, cwd, context, *, env=None, input=None, force_posix_path=False): os.makedirs(cwd, exist_ok=True) if env is None: env = DefaultEnv() log = None if force_posix_path: - transform_path = lambda v: ( - str(PurePosixPath(v)).replace("C:/", "/c/") if isinstance(v, Path) else v - ) + transform_path = win_to_posix_path else: transform_path = lambda v: v command = [str(transform_path(v)) for v in command]