Skip to content

Commit 19d9947

Browse files
nirbheekeli-schwartz
authored andcommitted
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. (cherry picked from commit ab261f9)
1 parent 4a622cf commit 19d9947

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
@@ -53,7 +53,21 @@
5353

5454
ALL_TYPES = ['file', 'git', 'hg', 'svn', 'redirect']
5555

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

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

0 commit comments

Comments
 (0)