Skip to content

Commit ec0744c

Browse files
committed
Search in both the environment's bin directory and the PATH
1 parent 8a45a0c commit ec0744c

File tree

2 files changed

+17
-8
lines changed

2 files changed

+17
-8
lines changed

cibuildwheel/platforms/android.py

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -508,21 +508,28 @@ def repair_default(
508508
new_soname = soname_with_hash(src_path)
509509
dst_path = libs_dir / new_soname
510510
shutil.copyfile(src_path, 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)
511+
call(which("patchelf"), "--set-soname", new_soname, dst_path)
516512

517513
for path in paths_to_patch:
518-
call(cibw_bin / "patchelf", "--replace-needed", old_soname, new_soname, path)
514+
call(which("patchelf"), "--replace-needed", old_soname, new_soname, path)
519515
call(
520-
cibw_bin / "patchelf",
516+
which("patchelf"),
521517
"--set-rpath",
522518
f"${{ORIGIN}}/{relpath(libs_dir, path.parent)}",
523519
path,
524520
)
525-
call(cibw_bin / "wheel", "pack", unpacked_dir, "-d", repaired_wheel_dir)
521+
call(which("wheel"), "pack", unpacked_dir, "-d", repaired_wheel_dir)
522+
523+
524+
# If cibuildwheel was called without activating its environment, the `bin` directory
525+
# will not be on the PATH.
526+
def which(cmd: str) -> str:
527+
cibw_bin = Path(sys.executable).parent
528+
result = shutil.which(cmd, path=f"{cibw_bin}{os.pathsep}{os.environ['PATH']}")
529+
if result is None:
530+
msg = f"Couldn't find {cmd!r} in {cibw_bin} or on the PATH"
531+
raise errors.FatalError(msg)
532+
return result
526533

527534

528535
def elf_file_filter(paths: Iterable[Path]) -> Iterator[tuple[Path, ELFFile]]:

examples/github-deploy.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ jobs:
3939
# runner. So we build on a non-ARM runner, which will skip the tests.
4040
runs-on: ubuntu-latest
4141
platform: android
42+
archs: arm64_v8a
4243
- os: ios
4344
runs-on: macos-latest
4445
platform: ios
@@ -53,6 +54,7 @@ jobs:
5354
uses: pypa/[email protected]
5455
env:
5556
CIBW_PLATFORM: ${{ matrix.platform || 'auto' }}
57+
CIBW_ARCHS: ${{ matrix.archs || 'auto' }}
5658
# Can also be configured directly, using `with:`
5759
# with:
5860
# package-dir: .

0 commit comments

Comments
 (0)