From: Peter Hutterer Date: Wed, 23 Oct 2019 03:13:50 +0000 (+0000) Subject: make-event-names.py should take the files as argument X-Git-Tag: libevdev-1.8.901~82 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9a5f44a605c89c9831311c0e932f909ca2d5e9c7;p=platform%2Fupstream%2Flibevdev.git make-event-names.py should take the files as argument Don't rely on cat, just let our script read everything as required. Signed-off-by: Peter Hutterer --- diff --git a/configure.ac b/configure.ac index 6784989..b284acb 100644 --- a/configure.ac +++ b/configure.ac @@ -127,7 +127,6 @@ AC_SUBST([GCOV_LDFLAGS]) AC_MSG_RESULT([$enable_gcov]) AM_PATH_PYTHON([2.6]) -AC_PATH_PROG(CAT, [cat]) # nm to check for leaking symbols in the static library AC_PATH_PROG(NM, [nm]) diff --git a/libevdev/Makefile.am b/libevdev/Makefile.am index fcb434d..f2757de 100644 --- a/libevdev/Makefile.am +++ b/libevdev/Makefile.am @@ -28,7 +28,7 @@ libevdevincludedir = $(includedir)/libevdev-1.0/libevdev libevdevinclude_HEADERS = libevdev.h libevdev-uinput.h event-names.h: Makefile make-event-names.py - $(CAT) $(top_srcdir)/include/linux/input.h $(top_srcdir)/include/linux/input-event-codes.h | $(PYTHON) $(srcdir)/make-event-names.py > $@ + $(PYTHON) $(srcdir)/make-event-names.py $(top_srcdir)/include/linux/input.h $(top_srcdir)/include/linux/input-event-codes.h > $@ EXTRA_DIST = make-event-names.py libevdev.sym diff --git a/libevdev/make-event-names.py b/libevdev/make-event-names.py index 716c1d7..820eb5e 100755 --- a/libevdev/make-event-names.py +++ b/libevdev/make-event-names.py @@ -195,10 +195,8 @@ def parse_define(bits, line): b = getattr(bits, attrname) b[value] = name -def parse(fp): +def parse(lines): bits = Bits() - - lines = fp.readlines() for line in lines: if not line.startswith("#define"): continue @@ -207,12 +205,14 @@ def parse(fp): return bits def usage(prog): - print("Usage: cat | %s" % prog) + print("Usage: %s ".format(prog)) if __name__ == "__main__": - if len(sys.argv) != 1: + if len(sys.argv) <= 1: usage(sys.argv[0]) sys.exit(2) - bits = parse(sys.stdin) + from itertools import chain + lines = chain(*[open(f).readlines() for f in sys.argv[1:]]) + bits = parse(lines) print_mapping_table(bits)