@@ -508,17 +508,21 @@ def repair_default(
508
508
new_soname = soname_with_hash (src_path )
509
509
dst_path = libs_dir / new_soname
510
510
shutil .copyfile (src_path , dst_path )
511
- call ("patchelf" , "--set-soname" , new_soname , dst_path )
511
+
512
+ # If cibuildwheel was called without activating its environment, the `bin`
513
+ # directory will not be on the PATH.
514
+ cibw_bin = Path (sys .executable ).parent
515
+ call (cibw_bin / "patchelf" , "--set-soname" , new_soname , dst_path )
512
516
513
517
for path in paths_to_patch :
514
- call ("patchelf" , "--replace-needed" , old_soname , new_soname , path )
518
+ call (cibw_bin / "patchelf" , "--replace-needed" , old_soname , new_soname , path )
515
519
call (
516
- "patchelf" ,
520
+ cibw_bin / "patchelf" ,
517
521
"--set-rpath" ,
518
522
f"${{ORIGIN}}/{ relpath (libs_dir , path .parent )} " ,
519
523
path ,
520
524
)
521
- call (sys . executable , "-m" , "wheel" , "pack" , unpacked_dir , "-d" , repaired_wheel_dir )
525
+ call (cibw_bin / "wheel" , "pack" , unpacked_dir , "-d" , repaired_wheel_dir )
522
526
523
527
524
528
def elf_file_filter (paths : Iterable [Path ]) -> Iterator [tuple [Path , ELFFile ]]:
0 commit comments