Skip to contentSkip to conversation

python3-gpiod: fetch sources from pypi

PATCH New Bartosz Golaszewski 1 participant 5 messages Apr 14, 2023

lore
Share & tools
lore
#0 lore raw

v2 cover python3-gpiod: fetch sources from pypi

From: Bartosz Golaszewski <[email protected]>

Khem,

There were two issues in the previous version. First, the gpiosim.h header is not installed as it's for tests only so we need to manually install it when ptests are enabled so that the python package can see it in its sysroot. The second issue were the PTEST_FLAGS that were not correctly expanded. I dropped them now as they are no longer needed when using the python build front-end.

I added an additional patch which removed libgpiod-src.inc as it's no longer required by python3-gpiod. Tested with gcc & clang and glibc & musl.

Bartosz Golaszewski (4):
python3-gpiod: add missing run-time dependencies
libgpiod: install the libgpiosim header
python3-gpiod: fetch sources from pypi
libgpiod: fold libgpiod-src.inc into libgpiod.inc

 .../recipes-support/libgpiod/libgpiod-src.inc |  1 -
 meta-oe/recipes-support/libgpiod/libgpiod.inc |  7 +--
 .../libgpiod/libgpiod_2.0.1.bb                |  6 +++
 .../python/python3-gpiod_2.0.1.bb             | 38 ++++++++++++++++
 .../python/python3-gpiod_2.0.bb               | 45 -------------------
 5 files changed, 48 insertions(+), 49 deletions(-)
 delete mode 100644 meta-oe/recipes-support/libgpiod/libgpiod-src.inc
 create mode 100644 meta-python/recipes-devtools/python/python3-gpiod_2.0.1.bb
 delete mode 100644 meta-python/recipes-devtools/python/python3-gpiod_2.0.bb
Signature · 1 line
2.37.2
#1 lore raw

PATCH v2 1/4 python3-gpiod: add missing run-time dependencies

From: Bartosz Golaszewski <[email protected]>

The gpiod package needs some standard python modules so add them to RDEPENDS.

---
 meta-python/recipes-devtools/python/python3-gpiod_2.0.bb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta-python/recipes-devtools/python/python3-gpiod_2.0.bb +5 -1
index 93b7b935c..e39d5beb1 100644
@@ -18,7 +18,11 @@ S = "${WORKDIR}/libgpiod-${PV}/bindings/python"
 inherit setuptools3 ptest
 
 DEPENDS += "libgpiod"
-RDEPENDS:${PN} += "libgpiod (>= 2.0)"
+RDEPENDS:${PN} += " \
+    libgpiod (>= 2.0) \
+    python3-datetime \
+    python3-profile \
+"
 RDEPENDS:${PN}-ptest += "python3-setuptools"
 
 export GPIOD_WITH_TESTS = "${@bb.utils.contains("PTEST_ENABLED", "1", "1", "0", d)}"
Signature · 1 line
2.37.2
#2 lore raw

PATCH v2 2/4 libgpiod: install the libgpiosim header

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

This header is used for building tests. While libgpiod can access it from the source tree, the python bindings that live in a separate recipe must be able to use it from its recipe sysroot.

---
 meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb | 6 ++++++
 1 file changed, 6 insertions(+)
meta-oe/recipes-support/libgpiod/libgpiod_2.0.1.bb +6 -0
index 50b9203a7..337554cd8 100644
@@ -15,7 +15,13 @@ SRC_URI[sha256sum] = "b5367d28d045b36007a4ffd42cceda4c358737ef4f2ce22b0c1d05ec57
 PACKAGECONFIG[tests] = "--enable-tests --enable-tools --enable-bindings-cxx --enable-gpioset-interactive,--disable-tests,kmod util-linux glib-2.0 catch2 libedit"
 PACKAGECONFIG[gpioset-interactive] = "--enable-gpioset-interactive,--disable-gpioset-interactive,libedit"
 
+PACKAGES =+ "${PN}-ptest-dev"
 FILES:${PN}-tools += "${bindir}/gpionotify"
 FILES:${PN}-ptest += "${libdir}/libgpiosim.so.*"
+FILES:${PN}-ptest-dev += "${includedir}/gpiosim.h"
 
 RRECOMMENDS:${PN}-ptest += "kernel-module-gpio-sim"
+
+do_install_ptest:append() {
+    install -m 0644 ${S}/tests/gpiosim/gpiosim.h ${D}${includedir}/gpiosim.h
+}
Signature · 1 line
2.37.2
#3 lore raw

PATCH v2 3/4 python3-gpiod: fetch sources from pypi

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Python bindings to libgpiod are now available on pypi. The source package is a limited subset of the original repository. As such the ptest package now requires the libgpiod-ptest to be available at run-time (for libgpiosim.so against which the test C extension is linked).

The problem with installing the C extensions for tests is now fixed so drop the do_install:append(). We no longer have to pass any additional CFLAGS to setup.py either.

We update the version of the recipe but the changes only apply to building and packaging, there are no functional changes to the code.

---
 .../python/python3-gpiod_2.0.1.bb             | 38 ++++++++++++++
 .../python/python3-gpiod_2.0.bb               | 49 -------------------
 2 files changed, 38 insertions(+), 49 deletions(-)
 create mode 100644 meta-python/recipes-devtools/python/python3-gpiod_2.0.1.bb
 delete mode 100644 meta-python/recipes-devtools/python/python3-gpiod_2.0.bb
meta-python/recipes-devtools/python/python3-gpiod_2.0.1.bb new file +38 -0
new file mode 100644
index 000000000..f833e6903
@@ -0,0 +1,38 @@
+SUMMARY = "Python bindings for libgpiod."
+AUTHOR = "Bartosz Golaszewski <[email protected]>"
+
+LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & CC-BY-SA-4.0"
+# The actual license files live in the upstream libgpiod from which the pypi
+# package is spun out.
+LIC_FILES_CHKSUM = "file://setup.py;beginline=57;endline=57;md5=120334ed83ec0cb248605e775bd13b87"
+
+SRC_URI += "file://run-ptest"
+
+SRC_URI[sha256sum] = "d5c0f9502e97e7359b9dd601e29f15d668983ce50f5c13323f3302845f790fa6"
+
+inherit setuptools3 ptest pypi
+
+PYPI_PACKAGE = "libgpiod"
+
+DEPENDS += "libgpiod"
+RDEPENDS:${PN} += " \
+    libgpiod (>= 2.0) \
+    python3-datetime \
+    python3-profile \
+"
+RDEPENDS:${PN}-ptest += " \
+    libgpiod-ptest \
+    python3-setuptools \
+"
+
+export GPIOD_WITH_TESTS = "${@bb.utils.contains("PTEST_ENABLED", "1", "1", "0", d)}"
+
+do_install_ptest() {
+    install -d ${D}${PTEST_PATH}/gpiod-test/gpiosim
+    install -d ${D}${PTEST_PATH}/gpiod-test/procname
+    install -m 0644 ${S}/tests/*.py ${D}${PTEST_PATH}/gpiod-test/
+    install -m 0644 ${B}/build/lib*/tests/gpiosim/_ext* ${D}${PTEST_PATH}/gpiod-test/gpiosim
+    install -m 0644 ${S}/tests/gpiosim/*.py ${D}${PTEST_PATH}/gpiod-test/gpiosim
+    install -m 0644 ${B}/build/lib*/tests/procname/_ext* ${D}${PTEST_PATH}/gpiod-test/procname
+    install -m 0644 ${S}/tests/procname/*.py ${D}${PTEST_PATH}/gpiod-test/procname
+}
meta-python/recipes-devtools/python/python3-gpiod_2.0.bb deleted +0 -49

49 lines not on this page · raw message

Signature · 1 line
2.37.2
#4 lore raw

PATCH v2 4/4 libgpiod: fold libgpiod-src.inc into libgpiod.inc

In reply to Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

Now that python3-gpiod fetches the sources from pypi, we no longer need to provide the SRC_URI in a separate include. Fold it into the libgpiod.inc used locally only.

---
 meta-oe/recipes-support/libgpiod/libgpiod-src.inc | 1 -
 meta-oe/recipes-support/libgpiod/libgpiod.inc     | 7 ++++---
 2 files changed, 4 insertions(+), 4 deletions(-)
 delete mode 100644 meta-oe/recipes-support/libgpiod/libgpiod-src.inc
meta-oe/recipes-support/libgpiod/libgpiod-src.inc deleted +0 -1
deleted file mode 100644
index 6bab4c1f4..000000000
@@ -1 +0,0 @@
-SRC_URI += "https://www.kernel.org/pub/software/libs/libgpiod/libgpiod-${PV}.tar.xz"
meta-oe/recipes-support/libgpiod/libgpiod.inc +4 -3
index abb6544ec..53f9ec49c 100644
@@ -1,11 +1,12 @@
 SUMMARY = "C library and tools for interacting with the linux GPIO character device"
 AUTHOR = "Bartosz Golaszewski <[email protected]>"
 
-require libgpiod-src.inc
-
 inherit autotools pkgconfig ptest
 
-SRC_URI += "file://run-ptest"
+SRC_URI += " \
+    https://www.kernel.org/pub/software/libs/libgpiod/libgpiod-${PV}.tar.xz \
+    file://run-ptest \
+"
 
 PACKAGECONFIG[cxx] = "--enable-bindings-cxx,--disable-bindings-cxx"
 
Signature · 1 line
2.37.2