package/python-gpiod: new package

This adds the python bindings of libgpiod for version 2+.
While the python bindings for v1 were optionally built and
installed as part of the main libgpiod build, for v2 they have now been
published to pypi.org for easier consumption in the general python
ecosystem.

We need to set LINK_SYSTEM_LIBGPIOD=1 to actually build against the
system version of libgpiod which we install and not use a separate
bundled copy.

The package is licensed as libgpiod, but as published to pypi doesn't
include the LICENSE file that's part of upstream repository.
Reference pyproject.toml as that has the license identifier as a
workaround.

Signed-off-by: Marcus Hoffmann <buildroot@bubu1.eu>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Marcus Hoffmann
2025-11-20 13:44:26 +01:00
committed by Julien Olivain
parent 3e296a1511
commit b243b77ebe
5 changed files with 39 additions and 0 deletions

View File

@@ -2263,6 +2263,7 @@ F: package/picotool/
F: package/python-apscheduler/
F: package/python-crc/
F: package/python-django/
F: package/python-gpiod/
F: package/python-immutabledict/
F: package/python-jc/
F: package/python-log-rate-limit/

View File

@@ -1136,6 +1136,7 @@ menu "External python modules"
source "package/python-google-api-core/Config.in"
source "package/python-google-auth/Config.in"
source "package/python-googleapis-common-protos/Config.in"
source "package/python-gpiod/Config.in"
source "package/python-gpiozero/Config.in"
source "package/python-greenlet/Config.in"
source "package/python-grpc-requests/Config.in"

View File

@@ -0,0 +1,15 @@
config BR2_PACKAGE_PYTHON_GPIOD
bool "python-gpiod"
depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_10 # libgpiod2
depends on !BR2_PACKAGE_LIBGPIOD # libgpiod2
select BR2_PACKAGE_LIBGPIOD2
help
Python bindings for libgpiod (v2+).
https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/tree/bindings/python/
comment "python-gpiod needs kernel headers >= 5.10"
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_5_10
comment "python-gpiod is incompatible with libgpiod"
depends on BR2_PACKAGE_LIBGPIOD

View File

@@ -0,0 +1,5 @@
# md5, sha256 from https://pypi.org/pypi/gpiod/json
md5 62cf044aa3214d0ebee6aef78db2aa52 gpiod-2.4.0.tar.g
sha256 9243a1a59d084ec749d1df4a1e2f238ffb9d94515b0d9f5335460175143c3aa1 gpiod-2.4.0.tar.gz
# Locally computed
sha256 a2b24e2158144b22a77a6a404fc5a05911612c5b99d7ab6d0e2addcaeb7514a3 pyproject.toml

View File

@@ -0,0 +1,17 @@
################################################################################
#
# python-gpiod
#
################################################################################
PYTHON_GPIOD_VERSION = 2.4.0
PYTHON_GPIOD_SOURCE = gpiod-$(PYTHON_GPIOD_VERSION).tar.gz
PYTHON_GPIOD_SITE = https://files.pythonhosted.org/packages/0c/dc/5a6bd309345bd9cfa7e098174ab7e65367e408539b6c1998e4f267c673cd
PYTHON_GPIOD_SETUP_TYPE = setuptools
PYTHON_GPIOD_LICENSE = LGPL-2.1+
# The package license follows libgpiod's license but doesn't include the LICENSE text in the pypi distrobuted package again
PYTHON_GPIOD_LICENSE_FILES = pyproject.toml
PYTHON_GPIOD_DEPENDENCIES = libgpiod2
PYTHON_GPIOD_ENV = LINK_SYSTEM_LIBGPIOD=1
$(eval $(python-package))