diff --git a/relenv/runtime.py b/relenv/runtime.py index e2beca11..0740be8f 100644 --- a/relenv/runtime.py +++ b/relenv/runtime.py @@ -336,6 +336,14 @@ def wrapper( if relocate().is_elf(file): debug(f"Relenv - Found elf {file}") relocate().handle_elf(plat / file, rootdir / "lib", True, rootdir) + elif relocate().is_macho(file): + otool_bin = shutil.which("otool") + if otool_bin: + relocate().handle_macho(str(plat / file), str(rootdir), True) + else: + debug( + "The otool command is not available, please run `xcode-select --install`" + ) return wrapper diff --git a/tests/test_verify_build.py b/tests/test_verify_build.py index 47bbed12..93d96db6 100644 --- a/tests/test_verify_build.py +++ b/tests/test_verify_build.py @@ -835,6 +835,44 @@ def find_library(path, search): assert valid, p.stdout.decode() +@pytest.mark.skip_unless_on_darwin +@pytest.mark.parametrize("cryptography_version", ["42.0.5", "40.0.1"]) +def test_cryptography_rpath_darwin(pipexec, build, minor_version, cryptography_version): + # def find_library(path, search): + # for root, dirs, files in os.walk(path): + # for fname in files: + # if fname.startswith(search) and fname.endswith(".so"): + # return fname + + env = os.environ.copy() + env["RELENV_BUILDENV"] = "yes" + env["OPENSSL_DIR"] = f"{build}" + + if minor_version == "3.13": + env["PYO3_USE_ABI3_FORWARD_COMPATIBILITY"] = "1" + + p = subprocess.run( + [ + str(pipexec), + "install", + f"cryptography=={cryptography_version}", + "--no-cache-dir", + "--no-binary=cryptography", + ], + env=env, + ) + assert p.returncode != 1, "Failed to pip install cryptography" + p = subprocess.run( + [ + "otool", + "-L", + f"{build}/lib/python{minor_version}/site-packages/cryptography/hazmat/bindings/_rust.abi3.so", + ], + capture_output=True, + ) + assert "/usr/local" not in p.stdout.decode(), p.stdout.decode() + + @pytest.mark.skip_unless_on_linux def test_install_pycurl(pipexec, build): _install_ppbt(pipexec) @@ -1423,9 +1461,12 @@ def test_install_with_target_namespaces(pipexec, build, minor_version, build_ver @pytest.mark.skip_unless_on_linux -def test_debugpy(pipexec, build, minor_version): +def test_debugpy(pipexec, build, arch, minor_version): if "3.13" in minor_version: pytest.xfail("Failes on python 3.13.0") + if arch == "arm64": + pytest.xfail("Failes on arm64") + p = subprocess.run( [ str(pipexec),