summaryrefslogtreecommitdiff
path: root/src/udev
diff options
context:
space:
mode:
authorMichal Suchanek <msuchanek@suse.de>2017-06-27 11:48:45 +0200
committerMichal Suchanek <msuchanek@suse.de>2017-06-27 13:27:37 +0200
commit1b833237198ae8bcba38c4824dc849b402eab163 (patch)
tree63254899f258e483426d96d9d053d8df8948b1b6 /src/udev
parent259d1af8d6fbb4918a3d43597dbca8cafe06a979 (diff)
downloadsystemd-1b833237198ae8bcba38c4824dc849b402eab163.tar.gz
Use same script to build key list in Makefile and meson
Diffstat (limited to 'src/udev')
-rwxr-xr-xsrc/udev/generate-keyboard-gperf.py16
-rwxr-xr-xsrc/udev/generate-keyboard-keys-gperf.sh9
-rw-r--r--src/udev/meson.build4
3 files changed, 11 insertions, 18 deletions
diff --git a/src/udev/generate-keyboard-gperf.py b/src/udev/generate-keyboard-gperf.py
deleted file mode 100755
index 03d3bba7d3..0000000000
--- a/src/udev/generate-keyboard-gperf.py
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/usr/bin/env python3
-
-"""Generate keyboard-keys-from-name.gperf from keyboard-keys-list.txt
-"""
-
-import sys
-
-input = sys.argv[1]
-
-print("""\
-struct key_name { const char* name; unsigned short id; };
-%null-strings
-%%""")
-
-for line in open(input):
- print("{0}, {1}".format(line.rstrip()[4:].lower(), line.rstrip()))
diff --git a/src/udev/generate-keyboard-keys-gperf.sh b/src/udev/generate-keyboard-keys-gperf.sh
new file mode 100755
index 0000000000..36ce0bd6cc
--- /dev/null
+++ b/src/udev/generate-keyboard-keys-gperf.sh
@@ -0,0 +1,9 @@
+#!/bin/sh -eu
+awk ' BEGIN {
+ print "struct key_name { const char* name; unsigned short id; };"
+ print "%null-strings"
+ print "%%"
+ }
+
+ /^KEY_/ { print tolower(substr($1 ,5)) ", " $1 }
+' < "$1"
diff --git a/src/udev/meson.build b/src/udev/meson.build
index 9c81bce545..eeb341f8d1 100644
--- a/src/udev/meson.build
+++ b/src/udev/meson.build
@@ -59,13 +59,13 @@ keyboard_keys_list_txt = custom_target(
command : [generate_keyboard_keys_list, cpp],
capture : true)
-generate_keyboard_gperf = find_program('generate-keyboard-gperf.py')
+generate_keyboard_keys_gperf = find_program('generate-keyboard-keys-gperf.sh')
fname = 'keyboard-keys-from-name.gperf'
gperf_file = custom_target(
fname,
input : keyboard_keys_list_txt,
output : fname,
- command : [generate_keyboard_gperf, '@INPUT@'],
+ command : [generate_keyboard_keys_gperf, '@INPUT@'],
capture : true)
fname = 'keyboard-keys-from-name.h'