summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Martin <consume.noise@gmail.com>2014-01-06 18:38:13 +0100
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>2014-01-07 20:57:23 -0500
commit7b96442f0934eee15ea376f2b1a28d8eaf19135e (patch)
tree83224f2b48935131fd8f4370184a6f009fbea071 /src
parentaf813d662bbcc68fc00ea425d2730dc8266551eb (diff)
py: Generate complete dicts in event_names.py
Before, the generated dictionaries in event_names.py just had the bits to name mapping and a loop to add the name to bits mapping using items() afterwards. As of Python 3 items() returns a view, not a copy, resulting in an error as the dictionary was modified in place. Now, generate both the bits to name and name to bits mapping when creating event_names.py and make the loop obsolete. Signed-off-by: Daniel Martin <consume.noise@gmail.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/make-event-names.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/make-event-names.py b/src/make-event-names.py
index a62c2c3..296ae0e 100755
--- a/src/make-event-names.py
+++ b/src/make-event-names.py
@@ -58,10 +58,8 @@ def print_python_bits(bits, prefix):
print("%s_map = {" % (prefix))
for val, name in getattr(bits, prefix).items():
- print(" %d : \"%s\"," % (val, name))
+ print(" %d : \"%s\", \"%s\" : %d," % (val, name, name, val))
print("}")
- print("for k, v in %s_map.items():" % (prefix))
- print(" %s_map[v] = k" % (prefix))
print("")
def print_map(bits):