summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2023-04-29 16:24:18 +0530
committerXavier Claessens <xclaesse@gmail.com>2023-04-29 08:35:51 -0400
commitf71c9aebfbceb8623756b981392b6d6d2b4e7c22 (patch)
treec5f6ba64c2d0febe0f1ec969225d397406a2a755
parent6def03c787407fc4ff95595abab15083e757275e (diff)
downloadmeson-f71c9aebfbceb8623756b981392b6d6d2b4e7c22.tar.gz
wrap: Always pass posix paths to patch
patch on Windows is provided by MSYS, which only understands POSIX paths, with `/`. Using Windows paths with `\` results in a "file not found" error. We got a little lucky here because the path is relative, so the drive letter difference doesn't affect us.
-rw-r--r--mesonbuild/wrap/wrap.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py
index d1ed31246..b63d7a43e 100644
--- a/mesonbuild/wrap/wrap.py
+++ b/mesonbuild/wrap/wrap.py
@@ -794,7 +794,8 @@ class Resolver:
raise WrapException(f'Diff file "{path}" does not exist')
relpath = os.path.relpath(str(path), self.dirname)
if PATCH:
- cmd = [PATCH, '-f', '-p1', '-i', relpath]
+ # Always pass a POSIX path to patch, because on Windows it's MSYS
+ cmd = [PATCH, '-f', '-p1', '-i', str(Path(relpath).as_posix())]
elif GIT:
# If the `patch` command is not available, fall back to `git
# apply`. The `--work-tree` is necessary in case we're inside a