Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ tests/integration/sample_extension/src/sample_extension.c

# Downloaded by test script
tests/integration/patchelf-0.17.2.1-py2.py3-none-manylinux_2_5_x86_64.manylinux1_x86_64.musllinux_1_1_x86_64.whl
tests/integration/cryptography-46.0.3-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
37 changes: 24 additions & 13 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,27 @@ def _docker_images(session: nox.Session) -> list[str]:
return images_file.read_text().splitlines()


def _download_wheels_for_tests(session: nox.Session) -> None:
wheels = [
# for tests/integration/test_bundled_wheels.py::test_analyze_wheel_abi_static_exe
("patchelf==0.17.2.1", "py38", "manylinux1_x86_64"),
# for tests/integration/test_bundled_wheels.py::test_weak_symbols_not_blacklisted
("cryptography==46.0.3", "cp38", "manylinux_2_17_x86_64"),
]
for package, python_tag, platform in wheels:
session.run(
"pip",
"download",
"--only-binary=:all:",
"--no-deps",
"--dest=./tests/integration/",
f"--platform={platform}",
f"--implementation={python_tag[:2]}",
f"--python-version={python_tag[2:]}",
package,
)
Comment thread
mayeut marked this conversation as resolved.


@nox.session(python=PYTHON_ALL_VERSIONS, default=False)
def tests(session: nox.Session) -> None:
"""Run tests."""
Expand All @@ -68,19 +89,8 @@ def tests(session: nox.Session) -> None:
deps = nox.project.dependency_groups(pyproject, dep_group)
session.install("-U", "pip")
session.install("-e", ".", *deps)
# for tests/integration/test_bundled_wheels.py::test_analyze_wheel_abi_static_exe
session.run(
"pip",
"download",
"--only-binary",
":all:",
"--no-deps",
"--platform",
"manylinux1_x86_64",
"-d",
"./tests/integration/",
"patchelf==0.17.2.1",
)
_download_wheels_for_tests(session)

if RUNNING_CI:
posargs.extend(["--cov", "auditwheel", "--cov-config", "pyproject.toml"])
# pull manylinux images that will be used.
Expand Down Expand Up @@ -135,6 +145,7 @@ def develop(session: nox.Session) -> None:
pyproject = nox.project.load_toml("pyproject.toml")
deps = nox.project.dependency_groups(pyproject, "dev")
session.install("-e", ".", *deps)
_download_wheels_for_tests(session)


if __name__ == "__main__":
Expand Down
3 changes: 2 additions & 1 deletion src/auditwheel/elfutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,9 @@ def get_undefined_symbols(path: Path) -> set[str]:
section = elf.get_section_by_name(".dynsym")
if section is not None:
# look for all undef symbols
# if the symbol is weak don't consider it as undefined, it's "optional"
for sym in section.iter_symbols():
if sym["st_shndx"] == "SHN_UNDEF":
if sym["st_shndx"] == "SHN_UNDEF" and sym["st_info"]["bind"] != "STB_WEAK":
undef_symbols.add(sym.name)
return undef_symbols

Expand Down
17 changes: 17 additions & 0 deletions tests/integration/test_bundled_wheels.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,3 +258,20 @@ def test_main_lddtree(
"libraries": {},
}
assert expected_json == actual_json


Comment thread
mayeut marked this conversation as resolved.
def test_weak_symbols_not_blacklisted() -> None:
# https://github.com/pypa/auditwheel/issues/663
# the cryptography wheel overall policy was misclassified as manylinux_2_24_x86_64
# in auditwheel 6.5.1 because it uses the undefined weak symbol '__cxa_thread_atexit_impl'
result = analyze_wheel_abi(
None,
None,
HERE / "cryptography-46.0.3-cp38-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl",
frozenset(),
disable_isa_ext_check=False,
allow_graft=False,
)
assert result.policies.libc == Libc.GLIBC
assert result.policies.architecture == Architecture.x86_64
assert result.overall_policy.name == "manylinux_2_17_x86_64"