> -----Original Message----- > From: Bartosz Golaszewski <brgl@xxxxxxxx> > Sent: Tuesday, November 19, 2024 9:00 AM > To: Linus Walleij <linus.walleij@xxxxxxxxxx>; Kent Gibson > <warthog618@xxxxxxxxx>; Vincent Fazio <vfazio@xxxxxxxxxxx>; Phil Howard > <phil@xxxxxxxxxxxxx> > Cc: linux-gpio@xxxxxxxxxxxxxxx; Bartosz Golaszewski > <bartosz.golaszewski@xxxxxxxxxx> > Subject: [External] - [libgpiod][PATCH] bindings: python: drop distutils from > build_tests.py > > From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> > > 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. > > Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx> > --- > bindings/python/build_tests.py | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/bindings/python/build_tests.py b/bindings/python/build_tests.py > index 1760257..bfdc4c0 100644 > --- a/bindings/python/build_tests.py > +++ b/bindings/python/build_tests.py > @@ -2,8 +2,8 @@ > # SPDX-FileCopyrightText: 2023 Phil Howard <phil@xxxxxxxxxxxxx> > > """ > -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 Similar to the other patch, this requires setuptools >=60.2.0 which may not be the default on some distributions. For example, Ubuntu 22.04 which is still under active support ships with setuptools 59.x. and the version of setuptools included in a version of python built by, say, pyenv to do regression testing on earlier python versions may also not meet this requirement, so developers will need to prep a virtualenv with an updated setuptools most likely.