diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 964ee88e2f29..870b121c6040 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -397,6 +397,7 @@ def wrap_from_crates_io(self, subp_name: str, dep: CargoDependency) -> T.Optiona directory = f'{dep.package}-{version}' filename = f'{directory}.tar.gz' wrap_fname = os.path.join(self.subdir_root, f'{subp_name}.wrap') + patch_directory = os.path.join(self.subdir_root, 'packagefiles', dep.package) os.makedirs(self.subdir_root, exist_ok=True) with open(wrap_fname, 'w', encoding='utf-8') as f: f.write(textwrap.dedent(f'''\ @@ -407,6 +408,8 @@ def wrap_from_crates_io(self, subp_name: str, dep: CargoDependency) -> T.Optiona source_hash = {checksum} method = cargo ''')) + if os.path.exists(patch_directory): + f.write(f'patch_directory = {patch_directory}\n') return wrap_fname return None