|
9 | 9 | from datetime import datetime, timezone
|
10 | 10 | from os.path import isabs
|
11 | 11 | from pathlib import Path
|
12 |
| -from unittest import mock |
13 | 12 | from unittest.mock import Mock
|
14 | 13 |
|
15 | 14 | import pytest
|
|
26 | 25 | @pytest.mark.parametrize(
|
27 | 26 | ("file", "external_libs", "exclude"),
|
28 | 27 | [
|
29 |
| - ("cffi-1.5.0-cp27-none-linux_x86_64.whl", {"libffi.so.5"}, frozenset()), |
30 |
| - ("cffi-1.5.0-cp27-none-linux_x86_64.whl", set(), frozenset(["libffi.so.5"])), |
31 | 28 | (
|
32 | 29 | "cffi-1.5.0-cp27-none-linux_x86_64.whl",
|
33 |
| - {"libffi.so.5"}, |
34 |
| - frozenset(["libffi.so.noexist", "libnoexist.so.*"]), |
| 30 | + {"libffi.so.5", "libpython2.7.so.1.0"}, |
| 31 | + frozenset(), |
35 | 32 | ),
|
36 | 33 | (
|
37 | 34 | "cffi-1.5.0-cp27-none-linux_x86_64.whl",
|
38 | 35 | set(),
|
| 36 | + frozenset(["libffi.so.5", "libpython2.7.so.1.0"]), |
| 37 | + ), |
| 38 | + ( |
| 39 | + "cffi-1.5.0-cp27-none-linux_x86_64.whl", |
| 40 | + {"libffi.so.5", "libpython2.7.so.1.0"}, |
| 41 | + frozenset(["libffi.so.noexist", "libnoexist.so.*"]), |
| 42 | + ), |
| 43 | + ( |
| 44 | + "cffi-1.5.0-cp27-none-linux_x86_64.whl", |
| 45 | + {"libpython2.7.so.1.0"}, |
39 | 46 | frozenset(["libffi.so.[4,5]"]),
|
40 | 47 | ),
|
41 | 48 | (
|
42 | 49 | "cffi-1.5.0-cp27-none-linux_x86_64.whl",
|
43 |
| - {"libffi.so.5"}, |
| 50 | + {"libffi.so.5", "libpython2.7.so.1.0"}, |
44 | 51 | frozenset(["libffi.so.[6,7]"]),
|
45 | 52 | ),
|
46 | 53 | (
|
47 | 54 | "cffi-1.5.0-cp27-none-linux_x86_64.whl",
|
48 |
| - set(), |
| 55 | + {"libpython2.7.so.1.0"}, |
49 | 56 | frozenset([f"{HERE}/*"]),
|
50 | 57 | ),
|
51 |
| - ("cffi-1.5.0-cp27-none-linux_x86_64.whl", set(), frozenset(["libffi.so.*"])), |
| 58 | + ( |
| 59 | + "cffi-1.5.0-cp27-none-linux_x86_64.whl", |
| 60 | + {"libpython2.7.so.1.0"}, |
| 61 | + frozenset(["libffi.so.*"]), |
| 62 | + ), |
52 | 63 | ("cffi-1.5.0-cp27-none-linux_x86_64.whl", set(), frozenset(["*"])),
|
53 | 64 | (
|
54 | 65 | "python_snappy-0.5.2-pp260-pypy_41-linux_x86_64.whl",
|
@@ -170,13 +181,37 @@ def test_wheel_source_date_epoch(timestamp, tmp_path, monkeypatch):
|
170 | 181 | )
|
171 | 182 |
|
172 | 183 | monkeypatch.setenv("SOURCE_DATE_EPOCH", str(timestamp[0]))
|
173 |
| - # patchelf might not be available as we aren't running in a manylinux container |
174 |
| - # here. We don't need need it in this test, so just patch it. |
175 |
| - with mock.patch("auditwheel.patcher._verify_patchelf"): |
176 |
| - main_repair.execute(args, Mock()) |
177 |
| - |
| 184 | + main_repair.execute(args, Mock()) |
178 | 185 | output_wheel, *_ = list(wheel_output_path.glob("*.whl"))
|
179 | 186 | with zipfile.ZipFile(output_wheel) as wheel_file:
|
180 | 187 | for file in wheel_file.infolist():
|
181 | 188 | file_date_time = datetime(*file.date_time, tzinfo=timezone.utc)
|
182 | 189 | assert file_date_time.timestamp() == timestamp[1]
|
| 190 | + |
| 191 | + |
| 192 | +def test_libpython(tmp_path, caplog): |
| 193 | + wheel = HERE / "python_mscl-67.0.1.0-cp313-cp313-manylinux2014_aarch64.whl" |
| 194 | + args = Namespace( |
| 195 | + LIB_SDIR=".libs", |
| 196 | + ONLY_PLAT=False, |
| 197 | + PLAT="auto", |
| 198 | + STRIP=False, |
| 199 | + UPDATE_TAGS=True, |
| 200 | + WHEEL_DIR=tmp_path, |
| 201 | + WHEEL_FILE=[wheel], |
| 202 | + EXCLUDE=[], |
| 203 | + DISABLE_ISA_EXT_CHECK=False, |
| 204 | + ZIP_COMPRESSION_LEVEL=6, |
| 205 | + cmd="repair", |
| 206 | + func=Mock(), |
| 207 | + prog="auditwheel", |
| 208 | + verbose=0, |
| 209 | + ) |
| 210 | + main_repair.execute(args, Mock()) |
| 211 | + assert ( |
| 212 | + "Removing libpython3.13.so.1.0 dependency from python_mscl/_mscl.so" |
| 213 | + in caplog.text |
| 214 | + ) |
| 215 | + assert tuple(path.name for path in tmp_path.glob("*.whl")) == ( |
| 216 | + "python_mscl-67.0.1.0-cp313-cp313-manylinux2014_aarch64.manylinux_2_31_aarch64.whl", |
| 217 | + ) |
0 commit comments