diff options
| author | Nirbheek Chauhan <nirbheek@centricular.com> | 2025-07-13 14:41:28 +0100 |
|---|---|---|
| committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2025-07-19 04:19:55 +0530 |
| commit | ab261f9951f235c776b8664fbdbf0365a8cf535d (patch) | |
| tree | 260e4989493ba66196a3d8253fba2fc240ce7338 /mesonbuild/wrap/wrap.py | |
| parent | 7a3c5c7b1db2bae341664a0088ca501967be20a3 (diff) | |
| download | meson-ab261f9951f235c776b8664fbdbf0365a8cf535d.tar.gz | |
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.
Diffstat (limited to 'mesonbuild/wrap/wrap.py')
| -rw-r--r-- | mesonbuild/wrap/wrap.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 42747e035..d99a61816 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -57,7 +57,21 @@ WHITELIST_SUBDOMAIN = 'wrapdb.mesonbuild.com' ALL_TYPES = ['file', 'git', 'hg', 'svn', 'redirect'] -PATCH = shutil.which('patch') +if mesonlib.is_windows(): + from ..programs import ExternalProgram + from ..mesonlib import version_compare + _exclude_paths: T.List[str] = [] + while True: + _patch = ExternalProgram('patch', silent=True, exclude_paths=_exclude_paths) + if not _patch.found(): + break + if version_compare(_patch.get_version(), '>=2.6.1'): + break + _exclude_paths.append(os.path.dirname(_patch.get_path())) + PATCH = _patch.get_path() if _patch.found() else None +else: + PATCH = shutil.which('patch') + def whitelist_wrapdb(urlstr: str) -> urllib.parse.ParseResult: """ raises WrapException if not whitelisted subdomain """ |
