Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-10-16 08:46:36

0001 """Check the repair hook selects uv's patchelf ahead of the image's version."""
0002 
0003 import os
0004 from pathlib import Path
0005 import subprocess
0006 
0007 
0008 def test_repair_uses_uv_tool_bin(tmp_path):
0009     bin_dir = tmp_path / "bin"
0010     tool_bin = tmp_path / "uv tools"
0011     bin_dir.mkdir()
0012     tool_bin.mkdir()
0013     scripts = {
0014         bin_dir / "uv": """#!/bin/sh
0015 case "$2" in
0016   run) printf '%s' "$CIBW_REPAIR_WHEEL_COMMAND_LINUX" ;;
0017   install) exit 0 ;;
0018   dir) printf '%s' "$TEST_TOOL_BIN" ;;
0019   *) exit 1 ;;
0020 esac
0021 """,
0022         bin_dir / "patchelf": "#!/bin/sh\necho old\n",
0023         tool_bin / "patchelf": "#!/bin/sh\necho pinned\n",
0024         bin_dir / "auditwheel": '#!/bin/sh\n[ "$(patchelf)" = pinned ]\n',
0025     }
0026     for path, content in scripts.items():
0027         path.write_text(content)
0028         path.chmod(0o755)
0029     env = {
0030         **os.environ,
0031         "PATH": f"{bin_dir}:{os.environ['PATH']}",
0032         "TEST_TOOL_BIN": str(tool_bin),
0033         "CIBW_BUILD": "cp313-manylinux_x86_64",
0034     }
0035     command = subprocess.check_output(
0036         ["bash", str(Path(__file__).with_name("cibuildwheel.sh"))], env=env, text=True
0037     )
0038     subprocess.run(["sh", "-ec", command], env=env, check=True)