Skip to contentSkip to conversation

bindings: python: drop distutils from build_tests.py

PATCH New Bartosz Golaszewski 1 participant 1 message Nov 19, 2024 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bindings: python: drop distutils from build_tests.py

From: Bartosz Golaszewski <[email protected]>

The configure() function in setuptools.logging has been available since v61.0.0 release so for over 2,5 years. We can generally expect users of python bindings to be using relatively recent versions of required dependencies. At the same time distutils has long been deprecated.

Let's keep the try: guard for setuptools.logging.configure but instead of importing distutils if the former is unavailable, just do nothing and drop the deprecated import altogether.

---
 bindings/python/build_tests.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
bindings/python/build_tests.py +4 -6
index 1760257..bfdc4c0 100644
@@ -2,8 +2,8 @@
 # SPDX-FileCopyrightText: 2023 Phil Howard <[email protected]>
 
 """
-Bring up just enough of setuptools/distutils in order to build the gpiod
-test module C extensions.
+Bring up just enough of setuptools in order to build the gpiod test
+module C extensions.
 
 Set "build_temp" and "build_lib" so that our source directory is not
 polluted with artefacts in build/
@@ -81,10 +81,8 @@ try:
     from setuptools.logging import configure
 
     configure()
-except ImportError:
-    from distutils.log import DEBUG, set_verbosity
-
-    set_verbosity(DEBUG)
+except:
+    pass
 
 with tempfile.TemporaryDirectory(prefix="libgpiod-") as temp_dir:
     command = build_ext(dist)
Signature · 1 line
2.45.2