Skip to content

Commit

Permalink
cargo: Add patch_directory into generated wrap if available
Browse files Browse the repository at this point in the history
  • Loading branch information
xclaesse committed Oct 11, 2023
1 parent 8360b10 commit 30904b9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mesonbuild/wrap/wrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'''\
Expand All @@ -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

Expand Down

0 comments on commit 30904b9

Please sign in to comment.