Commit 938a2c379b1d65bf541fbe0a5f2c6ef148a96e26

Jasper St. Pierre 2013-07-17T17:49:10

makekeys: Move all of the table generation to Python This makes it easier to run the Python script manually.

diff --git a/Makefile.am b/Makefile.am
index fd6ca09..aa17e6d 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -192,8 +192,7 @@ update-keysyms:
 	    -e 's/#define\s*\(\w*\)XK_/#define XKB_KEY_\1/' \
 	    -e '/\(#ifdef\|#ifndef\|#endif\)/d' $(KEYSYMDEFS) >> $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
 	echo -en '\n\n#endif\n' >> $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h
-	echo -en '/* This file is autogenerated from Makefile.am; please do not commit directly. */\n\n' > $(top_srcdir)/src/ks_tables.h
-	LC_CTYPE=C python $(top_srcdir)/makekeys.py $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h >> $(top_srcdir)/src/ks_tables.h
+	LC_CTYPE=C python $(top_srcdir)/makekeys.py $(top_srcdir)/xkbcommon/xkbcommon-keysyms.h > $(top_srcdir)/src/ks_tables.h
 
 # Run this if you add/remove a new keyword to the xkbcomp scanner,
 # or just want to regenerate the gperf file.
diff --git a/makekeys.py b/makekeys.py
index 60c8e87..553a4a5 100644
--- a/makekeys.py
+++ b/makekeys.py
@@ -6,7 +6,9 @@ pattern = re.compile(r'^#define\s+XKB_KEY_(?P<name>\w+)\s+(?P<value>0x[0-9a-fA-F
 matches = [pattern.match(line) for line in open(sys.argv[1])]
 entries = [(m.group("name"), int(m.group("value"), 16)) for m in matches if m]
 
-print('''struct name_keysym {
+print('''/* This file is autogenerated from Makefile.am; please do not commit directly. */
+
+struct name_keysym {
     const char *name;
     xkb_keysym_t keysym;
 };\n''')