[Buildroot] [PATCH v2, 2/2] package/python-pysensors: add host-lm-sensors dependency

Fabrice Fontaine fontaine.fabrice at gmail.com
Thu Jan 4 10:10:22 UTC 2024


Hi Thomas,

Le jeu. 4 janv. 2024 à 10:55, Thomas Petazzoni
<thomas.petazzoni at bootlin.com> a écrit :
>
> Hello Fabrice,
>
> Thanks for the patch. See below some feedback.
>
> On Wed,  3 Jan 2024 18:37:41 +0100
> Fabrice Fontaine <fontaine.fabrice at gmail.com> wrote:
>
> > host-lm-sensors is needed to extract the version from libsensors.so and
> > avoid the following build failure raised since the addition of the
> > package in commit c8ff8d41c06f6b1cbc5cf8702a516411084ead16:
> >
> >   File "/home/buildroot/autobuild/instance-2/output-1/build/python-pysensors-0.0.4/setup.py", line 3, in <module>
> >     import sensors
> >   File "/home/buildroot/autobuild/instance-2/output-1/build/python-pysensors-0.0.4/sensors/__init__.py", line 20, in <module>
> >     raise ImportError("can't find the sensors library.")
> >
> > Fixes:
> >  - http://autobuild.buildroot.org/results/acd8583fb635ea27811405a2478182ddcd5642f7
>
> Does python-pysensors setup.py really need  the version of the
> lm-sensors library?
>
> I see this:
>
> #!/usr/bin/env python3
> from setuptools import setup
> import sensors
>
> setup(
>     name='PySensors',
>     version=sensors.__version__,
>     author=sensors.__author__,
>     author_email=sensors.__contact__,
>     packages=['sensors'],
>     # scripts=[],
>     url='http://pypi.python.org/pypi/PySensors/',
>     # download_url='',
>     license=sensors.__license__,
>     description='Python bindings to libsensors (via ctypes)',
>     long_description=open('README.rst').read(),
>     long_description_content_type="text/x-rst",
>     keywords=['sensors', 'hardware', 'monitoring'],
>     classifiers=[
>         'Development Status :: 3 - Alpha',
>         'Intended Audience :: Developers',
>         'License :: OSI Approved',
>         'License :: OSI Approved ::'
>         ' GNU Lesser General Public License v2 or later (LGPLv2+)',
>         'Operating System :: POSIX :: Linux',
>         'Programming Language :: Python',
>         'Programming Language :: Python :: 3',
>         'Programming Language :: Python :: 3.6',
>         'Programming Language :: Python :: Implementation',
>         'Programming Language :: Python :: Implementation :: CPython',
>         'Topic :: System',
>         'Topic :: System :: Hardware',
>         'Topic :: System :: Monitoring',
>     ],
>     python_requires=">=3.6",
> )
>
> So the "sensors" module is only being imported to get
> sensors.__version__, sensors.__author__ and sensors.__contact__,
> sensors.__license__, all of which are statically defined in the sensors
> module.
>
> So in practice, in the context of setup.py, this detection of the
> lm-sensors version is not used. I believe:
>
> __version__ = "0.0.4"
> __date__ = "2019-09-19"
> __author__ = "Marc 'BlackJack' Rintsch"
> __contact__ = 'marc at rintsch.de'
> __license__ = 'LGPL v2.1'
>
> Should just be moved directly to setup.py, and setup.py should not
> import sensors. From a quick look, none of those variables are used
> outside of setup.py. And of course this could be contributed upstream,
> explaining why "import sensors" at setup time is not good.

Indeed, this is a cleaner solution.
However, it should be noted that upstream is dead: latest version is
from 2019 and source code repository given on
https://pypi.org/project/PySensors/ is unreachable.

>
> Thomas
> --
> Thomas Petazzoni, co-owner and CEO, Bootlin
> Embedded Linux and Kernel engineering and training
> https://bootlin.com

Best Regards,

Fabrice



More information about the buildroot mailing list