diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2023-02-16 09:49:37 +0100 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2023-02-18 13:19:36 -0800 |
commit | 941b3bc262dd439eaf4bd6e0f2c7df8ed14c56cf (patch) | |
tree | 3654376f9b37ba5b0e1c08e07a330db07890583e /meta-python | |
parent | cd26db61af27a9f822492b1d67b0e39e6828e7cb (diff) | |
download | meta-openembedded-941b3bc262dd439eaf4bd6e0f2c7df8ed14c56cf.tar.gz |
python3-gpiod: new package
Add a recipe for libgpiod v2 python bindings. This is a release
candidate but once the proper v2.0 is released, it will be made public
on pypi and the recipe modified accordingly.
As libgpiod python bindings now use setuptools and not make, we can
separate the recipe from the rest of the library.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-python')
3 files changed, 61 insertions, 0 deletions
diff --git a/meta-python/recipes-core/packagegroups/packagegroup-meta-python.bb b/meta-python/recipes-core/packagegroups/packagegroup-meta-python.bb index 2275ccd6c5..2428674c42 100644 --- a/meta-python/recipes-core/packagegroups/packagegroup-meta-python.bb +++ b/meta-python/recipes-core/packagegroups/packagegroup-meta-python.bb | |||
@@ -157,6 +157,7 @@ RDEPENDS:packagegroup-meta-python3 = "\ | |||
157 | python3-gmqtt \ | 157 | python3-gmqtt \ |
158 | python3-gnupg \ | 158 | python3-gnupg \ |
159 | python3-google-api-python-client \ | 159 | python3-google-api-python-client \ |
160 | python3-gpiod \ | ||
160 | python3-gpsd-py3 \ | 161 | python3-gpsd-py3 \ |
161 | python3-graphviz \ | 162 | python3-graphviz \ |
162 | python3-greenlet \ | 163 | python3-greenlet \ |
diff --git a/meta-python/recipes-devtools/python/python3-gpiod/run-ptest b/meta-python/recipes-devtools/python/python3-gpiod/run-ptest new file mode 100644 index 0000000000..bf1244b07c --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-gpiod/run-ptest | |||
@@ -0,0 +1,15 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | cd $(dirname "$(readlink -f "$0")") | ||
4 | |||
5 | # python3-gpiod uses gpio-sim - a configfs-based testing module. We need to | ||
6 | # make sure configfs is mounted before running any tests. | ||
7 | modprobe configfs | ||
8 | mountpoint /sys/kernel/config > /dev/null || mount -t configfs configfs /sys/kernel/config | ||
9 | |||
10 | python3 -m gpiod-test -v > ./python3-gpiod.out 2>&1 | ||
11 | if [ $? -ne 0 ]; then | ||
12 | echo "FAIL: python3-gpiod" | ||
13 | else | ||
14 | echo "PASS: python3-gpiod" | ||
15 | fi | ||
diff --git a/meta-python/recipes-devtools/python/python3-gpiod_2.0-rc2.bb b/meta-python/recipes-devtools/python/python3-gpiod_2.0-rc2.bb new file mode 100644 index 0000000000..0a16ce06bd --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-gpiod_2.0-rc2.bb | |||
@@ -0,0 +1,45 @@ | |||
1 | SUMMARY = "Python bindings for libgpiod." | ||
2 | AUTHOR = "Bartosz Golaszewski <brgl@bgdev.pl>" | ||
3 | |||
4 | LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & CC-BY-SA-4.0" | ||
5 | LIC_FILES_CHKSUM = " \ | ||
6 | file://../../LICENSES/GPL-2.0-or-later.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ | ||
7 | file://../../LICENSES/LGPL-2.1-or-later.txt;md5=4b54a1fd55a448865a0b32d41598759d \ | ||
8 | file://../../LICENSES/CC-BY-SA-4.0.txt;md5=fba3b94d88bfb9b81369b869a1e9a20f \ | ||
9 | " | ||
10 | |||
11 | require recipes-support/libgpiod/libgpiod-src.inc | ||
12 | |||
13 | SRC_URI += "file://run-ptest" | ||
14 | |||
15 | SRC_URI[sha256sum] = "1b931bfabef897911e59d45c80b8930c43fa72f08aab9c03e8dfd4005881c09e" | ||
16 | S = "${WORKDIR}/libgpiod-2.0/bindings/python" | ||
17 | |||
18 | inherit setuptools3 ptest | ||
19 | |||
20 | DEPENDS += "libgpiod" | ||
21 | RDEPENDS:${PN} += "libgpiod (>= 2.0)" | ||
22 | RDEPENDS:${PN}-ptest += "python3-setuptools" | ||
23 | |||
24 | export GPIOD_WITH_TESTS = "${@bb.utils.contains("PTEST_ENABLED", "1", "1", "0", d)}" | ||
25 | PTEST_CFLAGS = "${@bb.utils.contains("PTEST_ENABLED", "1", "-I../../tests/gpiosim", "", d)}" | ||
26 | # Setuptools store full filesystem paths in DWARF files. Map them to './' to | ||
27 | # avoid QA warnings. | ||
28 | export CFLAGS = "${PTEST_CFLAGS} -fdebug-prefix-map=${B}=./" | ||
29 | |||
30 | do_install:append() { | ||
31 | # Python setuptools have an issue where they install C extensions even if | ||
32 | # they're not in the list of packages to be packaged. This is how the test | ||
33 | # extensions end up being installed. Remove them here. | ||
34 | rm -rf ${D}${PYTHON_SITEPACKAGES_DIR}/tests/ | ||
35 | } | ||
36 | |||
37 | do_install_ptest() { | ||
38 | install -d ${D}${PTEST_PATH}/gpiod-test/gpiosim | ||
39 | install -d ${D}${PTEST_PATH}/gpiod-test/procname | ||
40 | install -m 0644 ${B}/tests/*.py ${D}${PTEST_PATH}/gpiod-test/ | ||
41 | install -m 0644 ${B}/build/lib*/tests/gpiosim/_ext* ${D}${PTEST_PATH}/gpiod-test/gpiosim | ||
42 | install -m 0644 ${B}/tests/gpiosim/*.py ${D}${PTEST_PATH}/gpiod-test/gpiosim | ||
43 | install -m 0644 ${B}/build/lib*/tests/procname/_ext* ${D}${PTEST_PATH}/gpiod-test/procname | ||
44 | install -m 0644 ${B}/tests/procname/*.py ${D}${PTEST_PATH}/gpiod-test/procname | ||
45 | } | ||