summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-08-05 15:07:41 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2016-08-09 00:42:52 -0400
commitc3f6a561e2fcda5b41569e7bf7785fad825d3a72 (patch)
tree4951d5ff25a88121e0aa48139431edae8aa25998
parent2abd461344f3a4d37584795a2644c102c098edc8 (diff)
build-sys: hook up the hwdb parser to check
-rw-r--r--Makefile.am6
-rwxr-xr-x[-rw-r--r--]hwdb/parse_hwdb.py14
2 files changed, 14 insertions, 6 deletions
diff --git a/Makefile.am b/Makefile.am
index bf853c8f90..d4e3e9a013 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3872,7 +3872,8 @@ TESTS += \
if HAVE_PYTHON
TESTS += \
- test/rule-syntax-check.py
+ test/rule-syntax-check.py \
+ hwdb/parse_hwdb.py
if HAVE_SYSV_COMPAT
TESTS += \
@@ -3924,7 +3925,8 @@ EXTRA_DIST += \
test/udev-test.pl \
test/rule-syntax-check.py \
test/sysv-generator-test.py \
- test/mocks/fsck
+ test/mocks/fsck \
+ hwdb/parse_hwdb.py
# ------------------------------------------------------------------------------
ata_id_SOURCES = \
diff --git a/hwdb/parse_hwdb.py b/hwdb/parse_hwdb.py
index 773513eaf0..99d034b4e0 100644..100755
--- a/hwdb/parse_hwdb.py
+++ b/hwdb/parse_hwdb.py
@@ -1,3 +1,4 @@
+#!/usr/bin/python3
# -*- Mode: python; coding: utf-8; indent-tabs-mode: nil -*- */
#
# This file is part of systemd.
@@ -17,9 +18,11 @@
# You should have received a copy of the GNU Lesser General Public License
# along with systemd; If not, see <http://www.gnu.org/licenses/>.
-import sys
-import string
import functools
+import glob
+import string
+import sys
+import os
try:
from pyparsing import (Word, White, Literal, ParserElement, Regex,
@@ -29,7 +32,8 @@ try:
stringEnd, pythonStyleComment,
ParseBaseException)
except ImportError:
- sys.exit('pyparsing is not available')
+ print('pyparsing is not available')
+ sys.exit(77)
try:
from evdev.ecodes import ecodes
@@ -168,7 +172,9 @@ def print_summary(fname, groups):
))
if __name__ == '__main__':
- for fname in sys.argv[1:]:
+ args = sys.argv[1:] or glob.glob(os.path.dirname(sys.argv[0]) + '/[67]0-*.hwdb')
+
+ for fname in args:
groups = parse(fname)
print_summary(fname, groups)
check_match_uniqueness(groups)