package/python-pysensors: fix build without host lm-sensors

Fix the following build failure raised since the addition of the
package in commit c8ff8d41c0:

  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

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Tested-by: Brandon Maier <brandon.maier@collins.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Fabrice Fontaine 2024-01-04 18:17:36 +01:00 committed by Thomas Petazzoni
parent 5b12863107
commit d1eea4f90c
2 changed files with 56 additions and 1 deletions

View File

@ -0,0 +1,55 @@
Remove import sensors from setup.py
Don't import sensors in setup.py to avoid adding a dependency on host
lm-sensors. Instead, move __version__, __author__, __contact__ and
__license__ to setup.py
Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Upstream: upstream is dead since 2019
diff '--color=auto' -Nura PySensors-0.0.4.orig/sensors/__init__.py PySensors-0.0.4/sensors/__init__.py
--- PySensors-0.0.4.orig/sensors/__init__.py 2024-01-04 13:47:07.114179107 +0100
+++ PySensors-0.0.4/sensors/__init__.py 2024-01-04 14:07:24.701178768 +0100
@@ -6,12 +6,6 @@
from sensors import stdc
-__version__ = "0.0.4"
-__date__ = "2019-09-19"
-__author__ = "Marc 'BlackJack' Rintsch"
-__contact__ = 'marc@rintsch.de'
-__license__ = 'LGPL v2.1'
-
API_VERSION = 4
DEFAULT_CONFIG_FILENAME = b"/etc/sensors3.conf"
diff '--color=auto' -Nura PySensors-0.0.4.orig/setup.py PySensors-0.0.4/setup.py
--- PySensors-0.0.4.orig/setup.py 2024-01-04 13:47:07.114179107 +0100
+++ PySensors-0.0.4/setup.py 2024-01-04 14:07:04.657260411 +0100
@@ -1,17 +1,21 @@
#!/usr/bin/env python3
from setuptools import setup
-import sensors
+
+__version__ = "0.0.4"
+__author__ = "Marc 'BlackJack' Rintsch"
+__contact__ = 'marc@rintsch.de'
+__license__ = 'LGPL v2.1'
setup(
name='PySensors',
- version=sensors.__version__,
- author=sensors.__author__,
- author_email=sensors.__contact__,
+ version=__version__,
+ author=__author__,
+ author_email=__contact__,
packages=['sensors'],
# scripts=[],
url='http://pypi.python.org/pypi/PySensors/',
# download_url='',
- license=sensors.__license__,
+ license=__license__,
description='Python bindings to libsensors (via ctypes)',
long_description=open('README.rst').read(),
long_description_content_type="text/x-rst",

View File

@ -1,6 +1,6 @@
config BR2_PACKAGE_PYTHON_PYSENSORS
bool "python-pysensors"
select BR2_PACKAGE_LM_SENSORS
select BR2_PACKAGE_LM_SENSORS # runtime
help
Python bindings for libsensors.so from the lm-sensors project
via ctypes. Supports API version 4, i.e. libsensors version