Skip to content

Commit

Permalink
Use / in env path
Browse files Browse the repository at this point in the history
  • Loading branch information
mgautierfr committed Nov 23, 2023
1 parent a88ab91 commit 75bd1c6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions kiwixbuild/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("\\", "/")
Expand All @@ -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)
Expand Down

0 comments on commit 75bd1c6

Please sign in to comment.