@@ -129,6 +129,8 @@ class _Entry(typing.NamedTuple):
129129 # list to store install RPATH to be able to add append more
130130 # entries when needed.
131131 install_rpath : List [str ] = []
132+ # RPATH entries to remove at install time.
133+ build_rpath : List [str ] = []
132134
133135
134136def _map_to_wheel (
@@ -188,7 +190,8 @@ def _map_to_wheel(
188190 wheel_files [path ].append (_Entry (filedst , filesrc ))
189191 else :
190192 install_rpath = target .get ('install_rpath' )
191- wheel_files [path ].append (_Entry (dst , src , [install_rpath ] if install_rpath else []))
193+ build_rpath = target .get ('build_rpaths' )
194+ wheel_files [path ].append (_Entry (dst , src , [install_rpath ] if install_rpath else [], build_rpath or []))
192195
193196 return wheel_files
194197
@@ -454,15 +457,16 @@ def _stable_abi(self) -> Optional[str]:
454457 return 'abi3.abi3t' if abi3t else 'abi3'
455458 return None
456459
457- def _install_path (self , wheel_file : mesonpy ._wheelfile .WheelFile , origin : Path , destination : pathlib .Path ,
458- install_rpath : List [str ]) -> None :
460+ def _install_path (self , wheel_file : mesonpy ._wheelfile .WheelFile ,
461+ origin : Path , destination : pathlib .Path ,
462+ install_rpath : List [str ], build_rpath : List [str ]) -> None :
459463 """Add a file to the wheel."""
460464
461465 if self ._has_internal_libs and _is_native (origin ):
462466 libspath = os .path .relpath (self ._libs_dir , destination .parent )
463- mesonpy ._rpath .fix_rpath (origin , install_rpath , libspath )
464- elif install_rpath :
465- mesonpy ._rpath .fix_rpath (origin , install_rpath , None )
467+ mesonpy ._rpath .fix_rpath (origin , install_rpath , build_rpath , libspath )
468+ elif install_rpath or build_rpath :
469+ mesonpy ._rpath .fix_rpath (origin , install_rpath , build_rpath , None )
466470
467471 try :
468472 wheel_file .write (origin , destination .as_posix ())
@@ -506,7 +510,7 @@ def build(self, directory: Path) -> pathlib.Path:
506510 root = 'purelib' if self ._pure else 'platlib'
507511
508512 for path , entries in self ._manifest .items ():
509- for dst , src , install_rpath in entries :
513+ for dst , src , install_rpath , build_rpath in entries :
510514 counter .update (src )
511515
512516 if path == root :
@@ -517,7 +521,7 @@ def build(self, directory: Path) -> pathlib.Path:
517521 else :
518522 dst = pathlib .Path (self ._data_dir , path , dst )
519523
520- self ._install_path (whl , src , dst , install_rpath )
524+ self ._install_path (whl , src , dst , install_rpath , build_rpath )
521525
522526 return wheel_file
523527
0 commit comments