summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Congal <yoann.congal@smile.fr>2025-05-03 00:49:43 +0200
committerKhem Raj <raj.khem@gmail.com>2025-05-03 01:59:06 -0700
commitacaf3462d00ab84abf42a941a45e0fe0c7c0f75d (patch)
tree09832e33d0a364cf47fedd160fbf5d725994922b
parent6e136a6bdc86e23c8978f3f08101df31918c66cf (diff)
downloadmeta-openembedded-acaf3462d00ab84abf42a941a45e0fe0c7c0f75d.tar.gz
python3-evdev: upgrade 1.9.1 -> 1.9.2
* Remove a merged reproducibility patch * Adapt the --reproducible option Changelog (from [0]): 1.9.2 (May 01, 2025) ==================== - Add the "--reproducible" build option which removes the build date and used headers from the generated ``ecodes.c``. Example usage:: python -m build --config-setting=--build-option='build_ecodes --reproducible' -n - Use ``Generic`` to set precise type for ``InputDevice.path``. [0]: https://github.com/gvalkov/python-evdev/blob/v1.9.2/docs/changelog.rst Signed-off-by: Yoann Congal <yoann.congal@smile.fr> Signed-off-by: Khem Raj <raj.khem@gmail.com>
-rw-r--r--meta-python/recipes-devtools/python/python3-evdev/0001-Add-a-reproducibility-option-for-building-ecodes.c.patch116
-rw-r--r--meta-python/recipes-devtools/python/python3-evdev_1.9.2.bb (renamed from meta-python/recipes-devtools/python/python3-evdev_1.9.1.bb)5
2 files changed, 2 insertions, 119 deletions
diff --git a/meta-python/recipes-devtools/python/python3-evdev/0001-Add-a-reproducibility-option-for-building-ecodes.c.patch b/meta-python/recipes-devtools/python/python3-evdev/0001-Add-a-reproducibility-option-for-building-ecodes.c.patch
deleted file mode 100644
index e730519884..0000000000
--- a/meta-python/recipes-devtools/python/python3-evdev/0001-Add-a-reproducibility-option-for-building-ecodes.c.patch
+++ /dev/null
@@ -1,116 +0,0 @@
1From d05c1c9dd298cb95d7feccbddb5caa043a319a01 Mon Sep 17 00:00:00 2001
2From: Yoann Congal <yoann.congal@smile.fr>
3Date: Sun, 13 Apr 2025 00:52:13 +0200
4Subject: [PATCH] Add a reproducibility option for building ecodes.c
5
6ecodes.c currently contains the kernel info of the build machine and the
7full path of the input*.h headers: This is not reproducible as output
8can change even is headers content do not. Downstream distributions
9might package ecodes.c and get non-reproducible output.
10
11To fix this: introduce a --reproducible option in the build:
12- in setup.py build_ecodes command
13- in underlying genecodes_c.py
14
15Note: These options are disabled by default so no change is expected in
16current builds.
17
18Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
19Upstream-Status: Submitted [https://github.com/gvalkov/python-evdev/pull/242]
20---
21 setup.py | 13 ++++++++++---
22 src/evdev/genecodes_c.py | 17 +++++++++++------
23 2 files changed, 21 insertions(+), 9 deletions(-)
24
25diff --git a/setup.py b/setup.py
26index 6b721d7..3371199 100755
27--- a/setup.py
28+++ b/setup.py
29@@ -14,7 +14,7 @@ curdir = Path(__file__).resolve().parent
30 ecodes_c_path = curdir / "src/evdev/ecodes.c"
31
32
33-def create_ecodes(headers=None):
34+def create_ecodes(headers=None, reproducibility=False):
35 if not headers:
36 include_paths = set()
37 cpath = os.environ.get("CPATH", "").strip()
38@@ -65,7 +65,10 @@ def create_ecodes(headers=None):
39
40 print("writing %s (using %s)" % (ecodes_c_path, " ".join(headers)))
41 with ecodes_c_path.open("w") as fh:
42- cmd = [sys.executable, "src/evdev/genecodes_c.py", "--ecodes", *headers]
43+ cmd = [sys.executable, "src/evdev/genecodes_c.py"]
44+ if reproducibility:
45+ cmd.append("--reproducibility")
46+ cmd.extend(["--ecodes", *headers])
47 run(cmd, check=True, stdout=fh)
48
49
50@@ -74,17 +77,21 @@ class build_ecodes(Command):
51
52 user_options = [
53 ("evdev-headers=", None, "colon-separated paths to input subsystem headers"),
54+ ("reproducibility", None, "hide host details (host/paths) to create a reproducible output"),
55 ]
56
57 def initialize_options(self):
58 self.evdev_headers = None
59+ self.reproducibility = False
60
61 def finalize_options(self):
62 if self.evdev_headers:
63 self.evdev_headers = self.evdev_headers.split(":")
64+ if self.reproducibility is None:
65+ self.reproducibility = False
66
67 def run(self):
68- create_ecodes(self.evdev_headers)
69+ create_ecodes(self.evdev_headers, reproducibility=self.reproducibility)
70
71
72 class build_ext(_build_ext.build_ext):
73diff --git a/src/evdev/genecodes_c.py b/src/evdev/genecodes_c.py
74index 5c2d946..24cad27 100644
75--- a/src/evdev/genecodes_c.py
76+++ b/src/evdev/genecodes_c.py
77@@ -15,22 +15,27 @@ headers = [
78 "/usr/include/linux/uinput.h",
79 ]
80
81-opts, args = getopt.getopt(sys.argv[1:], "", ["ecodes", "stubs"])
82+opts, args = getopt.getopt(sys.argv[1:], "", ["ecodes", "stubs", "reproducibility"])
83 if not opts:
84- print("usage: genecodes.py [--ecodes|--stubs] <headers>")
85+ print("usage: genecodes.py [--ecodes|--stubs] [--reproducibility] <headers>")
86 exit(2)
87
88 if args:
89 headers = args
90
91+reproducibility = ("--reproducibility", "") in opts
92+
93
94 # -----------------------------------------------------------------------------
95 macro_regex = r"#define\s+((?:KEY|ABS|REL|SW|MSC|LED|BTN|REP|SND|ID|EV|BUS|SYN|FF|UI_FF|INPUT_PROP)_\w+)"
96 macro_regex = re.compile(macro_regex)
97
98-# Uname without hostname.
99-uname = list(os.uname())
100-uname = " ".join((uname[0], *uname[2:]))
101+if reproducibility:
102+ uname = "hidden for reproducibility"
103+else:
104+ # Uname without hostname.
105+ uname = list(os.uname())
106+ uname = " ".join((uname[0], *uname[2:]))
107
108
109 # -----------------------------------------------------------------------------
110@@ -138,5 +143,5 @@ elif ("--stubs", "") in opts:
111 template = template_stubs
112
113 body = os.linesep.join(body)
114-text = template % (uname, headers, body)
115+text = template % (uname, headers if not reproducibility else ["hidden for reproducibility"], body)
116 print(text.strip())
diff --git a/meta-python/recipes-devtools/python/python3-evdev_1.9.1.bb b/meta-python/recipes-devtools/python/python3-evdev_1.9.2.bb
index af88770c59..28c8ea4bc1 100644
--- a/meta-python/recipes-devtools/python/python3-evdev_1.9.1.bb
+++ b/meta-python/recipes-devtools/python/python3-evdev_1.9.2.bb
@@ -3,8 +3,7 @@ HOMEPAGE = "https://github.com/gvalkov/python-evdev"
3LICENSE = "BSD-3-Clause" 3LICENSE = "BSD-3-Clause"
4LIC_FILES_CHKSUM = "file://LICENSE;md5=d7bd1cc4c71b706c7e2d4053aef50f2a" 4LIC_FILES_CHKSUM = "file://LICENSE;md5=d7bd1cc4c71b706c7e2d4053aef50f2a"
5 5
6SRC_URI += "file://0001-Add-a-reproducibility-option-for-building-ecodes.c.patch" 6SRC_URI[sha256sum] = "5d3278892ce1f92a74d6bf888cc8525d9f68af85dbe336c95d1c87fb8f423069"
7SRC_URI[sha256sum] = "dc640a064cb1c9fe1f8b970dc2039945a2a275d7b7ee62284bf427238abe45ee"
8 7
9inherit pypi python_setuptools_build_meta 8inherit pypi python_setuptools_build_meta
10 9
@@ -14,7 +13,7 @@ do_compile:prepend() {
14 13
15PEP517_BUILD_OPTS = "--config-setting=--build-option='build_ecodes \ 14PEP517_BUILD_OPTS = "--config-setting=--build-option='build_ecodes \
16 --evdev-headers ${STAGING_DIR_TARGET}/usr/include/linux/input.h:${STAGING_DIR_TARGET}/usr/include/linux/input-event-codes.h \ 15 --evdev-headers ${STAGING_DIR_TARGET}/usr/include/linux/input.h:${STAGING_DIR_TARGET}/usr/include/linux/input-event-codes.h \
17 --reproducibility'" 16 --reproducible'"
18 17
19RDEPENDS:${PN} += "\ 18RDEPENDS:${PN} += "\
20 python3-ctypes \ 19 python3-ctypes \