Skip to content

Commit f8a7ff6

Browse files
authored
chore: remove direct usage of distutils (#447)
Python 3.12 removed the `distutils` module from stdlib. Adherence to this module in auditwheel sources shall be removed.
1 parent 325ac7b commit f8a7ff6

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/auditwheel/patcher.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from __future__ import annotations
22

33
import re
4-
from distutils.spawn import find_executable
54
from itertools import chain
5+
from shutil import which
66
from subprocess import CalledProcessError, check_call, check_output
77

88

@@ -23,9 +23,9 @@ def get_rpath(self, file_name: str) -> str:
2323
def _verify_patchelf() -> None:
2424
"""This function looks for the ``patchelf`` external binary in the PATH,
2525
checks for the required version, and throws an exception if a proper
26-
version can't be found. Otherwise, silcence is golden
26+
version can't be found. Otherwise, silence is golden
2727
"""
28-
if not find_executable("patchelf"):
28+
if not which("patchelf"):
2929
raise ValueError("Cannot find required utility `patchelf` in PATH")
3030
try:
3131
version = check_output(["patchelf", "--version"]).decode("utf-8")

tests/unit/test_elfpatcher.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
from auditwheel.patcher import Patchelf
99

1010

11-
@patch("auditwheel.patcher.find_executable")
12-
def test_patchelf_unavailable(find_executable):
13-
find_executable.return_value = False
11+
@patch("auditwheel.patcher.which")
12+
def test_patchelf_unavailable(which):
13+
which.return_value = False
1414
with pytest.raises(ValueError):
1515
Patchelf()
1616

0 commit comments

Comments
 (0)