Skip to content

Commit 089a062

Browse files
committed
wrap: Don't use old patch.exe from Strawberry Perl
It is too old and barfs on patches from git-format-patch: ``` Applying diff file "orc-0.4.38\0001-meson-fix-symbols-leaking-from-static-library-on-Win.patch" patching file meson.build Assertation failed! Program: C:\Strawberry\c\bin\patch.EXE File: .\src\patch\2.5.9\patch-2.5.9-src\patch.c, Line 354 Expression: hunk ``` 2.6.1 is the oldest known version that works correctly.
1 parent 12563f7 commit 089a062

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

mesonbuild/wrap/wrap.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,21 @@
5757

5858
ALL_TYPES = ['file', 'git', 'hg', 'svn', 'redirect']
5959

60-
PATCH = shutil.which('patch')
60+
if mesonlib.is_windows():
61+
from ..programs import ExternalProgram
62+
from ..mesonlib import version_compare
63+
_exclude_paths: List[str] = []
64+
while True:
65+
_patch = ExternalProgram('patch', silent=True, exclude_paths=_exclude_paths)
66+
if not _patch.found():
67+
break
68+
if version_compare(_patch.get_version(), ">=2.6.1"):
69+
break
70+
_exclude_paths.append(os.path.dirname(_patch.get_path()))
71+
PATCH = _patch.get_path() if _patch.found() else None
72+
else:
73+
PATCH = shutil.which('patch')
74+
6175

6276
def whitelist_wrapdb(urlstr: str) -> urllib.parse.ParseResult:
6377
""" raises WrapException if not whitelisted subdomain """

0 commit comments

Comments
 (0)