From 75bd1c63b8a30a0e69703429e80eef615692e29b Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Thu, 23 Nov 2023 16:11:54 +0100 Subject: [PATCH] Use `/` in env path --- kiwixbuild/utils.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/kiwixbuild/utils.py b/kiwixbuild/utils.py index c527c30b..698ef80e 100644 --- a/kiwixbuild/utils.py +++ b/kiwixbuild/utils.py @@ -275,6 +275,13 @@ def extract_archive(archive_path, dest_dir, topdir=None, name=None): if archive is not None: archive.close() +def transform_env(value): + value = value.replace('C:', '/c') + value = value.replace('\\', '/') + value = value.replace(";", ":") + value = escape_path(value) + return value + def transform_path(path): if path.startswith('C:'): path = "/c" + path[2:].replace("\\", "/") @@ -291,6 +298,8 @@ def run_command(command, cwd, context, *, env=None, input=None, shell=False): if shell: commands = (transform_path(p) for p in command) command = shlex.join(commands) + env = {k:transform_env(v) for k,v in env.items()} + print("run command '{}'".format(command), file=log) print("current directory is '{}'".format(cwd), file=log) print("env is :", file=log)