* [Buildroot] [PATCH v2 1/1] package/python-evdev: new package
@ 2023-04-17 13:03 Witold Lipieta
2023-04-17 20:59 ` Yann E. MORIN
0 siblings, 1 reply; 2+ messages in thread
From: Witold Lipieta @ 2023-04-17 13:03 UTC (permalink / raw)
To: buildroot; +Cc: Witold Lipieta, Yann E . MORIN, Thomas Petazzoni, Asaf Kahlon
evdev 1.6.1 https://pypi.org/project/evdev/
Signed-off-by: Witold Lipieta <witold.lipieta@thaumatec.com>
---
Changes v1 -> v2:
- remove runtime dependency
- add dependency on linux 4.4 headers
- pass path to uinput.h during setup
- add basic runtime check
---
package/Config.in | 1 +
package/python-evdev/Config.in | 7 +++++++
package/python-evdev/python-evdev.hash | 5 +++++
package/python-evdev/python-evdev.mk | 18 ++++++++++++++++++
.../tests/package/sample_python_evdev.py | 11 +++++++++++
.../testing/tests/package/test_python_evdev.py | 12 ++++++++++++
6 files changed, 54 insertions(+)
create mode 100644 package/python-evdev/Config.in
create mode 100644 package/python-evdev/python-evdev.hash
create mode 100644 package/python-evdev/python-evdev.mk
create mode 100644 support/testing/tests/package/sample_python_evdev.py
create mode 100644 support/testing/tests/package/test_python_evdev.py
diff --git a/package/Config.in b/package/Config.in
index 760dda6ac1..eaac32a01a 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -1049,6 +1049,7 @@ menu "External python modules"
source "package/python-engineio/Config.in"
source "package/python-entrypoints/Config.in"
source "package/python-esptool/Config.in"
+ source "package/python-evdev/Config.in"
source "package/python-falcon/Config.in"
source "package/python-filelock/Config.in"
source "package/python-fire/Config.in"
diff --git a/package/python-evdev/Config.in b/package/python-evdev/Config.in
new file mode 100644
index 0000000000..91e4642d48
--- /dev/null
+++ b/package/python-evdev/Config.in
@@ -0,0 +1,7 @@
+config BR2_PACKAGE_PYTHON_EVDEV
+ bool "python-evdev"
+ depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_4
+ help
+ Bindings to the Linux input handling subsystem.
+
+ https://github.com/gvalkov/python-evdev
diff --git a/package/python-evdev/python-evdev.hash b/package/python-evdev/python-evdev.hash
new file mode 100644
index 0000000000..9a6d0d07be
--- /dev/null
+++ b/package/python-evdev/python-evdev.hash
@@ -0,0 +1,5 @@
+# md5, sha256 from https://pypi.org/pypi/evdev/json
+md5 905b12ef6136b518ddf418d8d5b053e4 evdev-1.6.1.tar.gz
+sha256 299db8628cc73b237fc1cc57d3c2948faa0756e2a58b6194b5bf81dc2081f1e3 evdev-1.6.1.tar.gz
+# Locally computed sha256 checksums
+sha256 55fd76d7b3f90d312f161d318631b93c58a0e69d662d07c4f5aca2c6c9ecc85e LICENSE
diff --git a/package/python-evdev/python-evdev.mk b/package/python-evdev/python-evdev.mk
new file mode 100644
index 0000000000..5cf62b5160
--- /dev/null
+++ b/package/python-evdev/python-evdev.mk
@@ -0,0 +1,18 @@
+################################################################################
+#
+# python-evdev
+#
+################################################################################
+
+PYTHON_EVDEV_VERSION = 1.6.1
+PYTHON_EVDEV_SOURCE = evdev-$(PYTHON_EVDEV_VERSION).tar.gz
+PYTHON_EVDEV_SITE = https://files.pythonhosted.org/packages/05/50/629b011a7f61cb2fca754ea8631575784bf8605a1ec4d6970a010bc54e2b
+PYTHON_EVDEV_SETUP_TYPE = setuptools
+PYTHON_EVDEV_LICENSE = Revised BSD License
+PYTHON_EVDEV_LICENSE_FILES = LICENSE
+
+PYTHON_EVDEV_BUILD_OPTS = \
+ build_ecodes \
+ --evdev-headers $(STAGING_DIR)/usr/include/linux/input.h:$(STAGING_DIR)/usr/include/linux/input-event-codes.h:$(STAGING_DIR)/usr/include/linux/uinput.h
+
+$(eval $(python-package))
diff --git a/support/testing/tests/package/sample_python_evdev.py b/support/testing/tests/package/sample_python_evdev.py
new file mode 100644
index 0000000000..0c00fa6e2f
--- /dev/null
+++ b/support/testing/tests/package/sample_python_evdev.py
@@ -0,0 +1,11 @@
+import evdev
+
+devices = [evdev.InputDevice(path) for path in evdev.list_devices()]
+e = evdev.events.InputEvent(1036996631, 984417, evdev.ecodes.EV_KEY, evdev.ecodes.KEY_A, 2)
+k = evdev.events.KeyEvent(e)
+
+assert(k.keystate == evdev.events.KeyEvent.key_hold)
+assert(k.event == e)
+assert(k.scancode == evdev.ecodes.KEY_A)
+assert(k.keycode == 'KEY_A')
+assert(len(devices) > 0)
diff --git a/support/testing/tests/package/test_python_evdev.py b/support/testing/tests/package/test_python_evdev.py
new file mode 100644
index 0000000000..f2d64c7bd1
--- /dev/null
+++ b/support/testing/tests/package/test_python_evdev.py
@@ -0,0 +1,12 @@
+from tests.package.test_python import TestPythonPackageBase
+
+
+class TestPythonPy3Evdev(TestPythonPackageBase):
+ __test__ = True
+ config = TestPythonPackageBase.config + \
+ """
+ BR2_PACKAGE_PYTHON3=y
+ BR2_PACKAGE_PYTHON_EVDEV=y
+ """
+ sample_scripts = ["tests/package/sample_python_evdev.py"]
+
\ No newline at end of file
--
2.34.1
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Buildroot] [PATCH v2 1/1] package/python-evdev: new package
2023-04-17 13:03 [Buildroot] [PATCH v2 1/1] package/python-evdev: new package Witold Lipieta
@ 2023-04-17 20:59 ` Yann E. MORIN
0 siblings, 0 replies; 2+ messages in thread
From: Yann E. MORIN @ 2023-04-17 20:59 UTC (permalink / raw)
To: Witold Lipieta; +Cc: Asaf Kahlon, Thomas Petazzoni, buildroot
Witold, All,
On 2023-04-17 15:03 +0200, Witold Lipieta spake thusly:
> evdev 1.6.1 https://pypi.org/project/evdev/
>
> Signed-off-by: Witold Lipieta <witold.lipieta@thaumatec.com>
> ---
> Changes v1 -> v2:
> - remove runtime dependency
> - add dependency on linux 4.4 headers
> - pass path to uinput.h during setup
> - add basic runtime check
Thanks for the runtime test!
[--SNIP--]
> diff --git a/package/python-evdev/Config.in b/package/python-evdev/Config.in
> new file mode 100644
> index 0000000000..91e4642d48
> --- /dev/null
> +++ b/package/python-evdev/Config.in
> @@ -0,0 +1,7 @@
> +config BR2_PACKAGE_PYTHON_EVDEV
> + bool "python-evdev"
> + depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_4
> + help
> + Bindings to the Linux input handling subsystem.
> +
> + https://github.com/gvalkov/python-evdev
When there is a dependency on toolchain features, we add a comment about
that:
comment "python-evdev needs a toolchain w/ headers >= 4.4"
depends on !BR2_TOOLCHAIN_HEADERS_AT_LEAST_4_4
So i've added that.
[--SNIP--]
> diff --git a/support/testing/tests/package/test_python_evdev.py b/support/testing/tests/package/test_python_evdev.py
> new file mode 100644
> index 0000000000..f2d64c7bd1
> --- /dev/null
> +++ b/support/testing/tests/package/test_python_evdev.py
> @@ -0,0 +1,12 @@
> +from tests.package.test_python import TestPythonPackageBase
> +
> +
> +class TestPythonPy3Evdev(TestPythonPackageBase):
> + __test__ = True
> + config = TestPythonPackageBase.config + \
> + """
> + BR2_PACKAGE_PYTHON3=y
> + BR2_PACKAGE_PYTHON_EVDEV=y
> + """
> + sample_scripts = ["tests/package/sample_python_evdev.py"]
> +
> \ No newline at end of file
$ make check-package
support/testing/tests/package/test_python_evdev.py:0: run 'flake8' and fix the warnings
support/testing/tests/package/test_python_evdev.py:12:1: W391 blank line at end of file
support/testing/tests/package/test_python_evdev.py:12:1: W293 blank line contains whitespace
1 W293 blank line contains whitespace
1 W391 blank line at end of file
I also fixed that (and the "No newline at end of file" issue).
Applied to master, thanks.
Regards,
Yann E. MORIN.
> --
> 2.34.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-17 20:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-17 13:03 [Buildroot] [PATCH v2 1/1] package/python-evdev: new package Witold Lipieta
2023-04-17 20:59 ` Yann E. MORIN
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox