From 9f54fcfd93ac8ef624e6036eec64281dc117e03b Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 20 Dec 2023 11:48:11 +1000 Subject: [PATCH] Improve error debugging for invalid matches This needs to be printed to stdout, otherwise meson won't show it. --- test/test_udev_rules.py | 9 +++++++-- tools/libwacom-update-db.py | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/test/test_udev_rules.py b/test/test_udev_rules.py index 041890537..985a5b987 100644 --- a/test/test_udev_rules.py +++ b/test/test_udev_rules.py @@ -57,8 +57,13 @@ def pytest_generate_tests(metafunc): if bus not in ['usb', 'bluetooth']: continue - vid = int(vid, 16) - pid = int(pid, 16) + try: + vid = int(vid, 16) + pid = int(pid, 16) + except ValueError as e: + print(f"Invalid vid/pid in {match} in {f}", file=sys.stderr) + raise e + if bus == 'usb': bus = 0x3 elif bus == 'bluetooth': diff --git a/tools/libwacom-update-db.py b/tools/libwacom-update-db.py index c503c3381..7b0c29b91 100755 --- a/tools/libwacom-update-db.py +++ b/tools/libwacom-update-db.py @@ -132,7 +132,7 @@ def _load(self, path): try: bus, vid, pid, *_ = match.split(":") except ValueError as e: - print(f"Failed to process match {match}") + print(f"Failed to process match {match} in {file}", file=sys.stderr) raise e name = config["Device"]["Name"]