evemu: fix make-event-names.py for python3 syntax
PATCH 1/1 evemu: fix make-event-names.py for python3 syntax
--- ...-event-names-fix-for-python3-print-syntax.patch | 162 +++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 package/evemu/evemu-0004-make-event-names-fix-for-python3-print-syntax.patch
package/evemu/evemu-0004-make-event-names-fix-for-python3-print-syntax.patch new file +162 -0
@@ -0,0 +1,162 @@ +From da078b9ae22c86279a48ab9888a7b4a6eeadecda Mon Sep 17 00:00:00 2001 +From: Peter Seiderer <[email protected]> +Date: Sat, 26 Apr 2014 22:32:46 +0200 +Subject: [PATCH] make-event-names: fix for python3 print syntax + +Signed-off-by: Peter Seiderer <[email protected]> +--- + src/make-event-names.py | 98 ++++++++++++++++++++++++------------------------- + 1 file changed, 49 insertions(+), 49 deletions(-) + +diff --git a/src/make-event-names.py b/src/make-event-names.py +index 849d577..1c32bc8 100755 +--- a/src/make-event-names.py ++++ b/src/make-event-names.py +@@ -44,59 +44,59 @@ blacklist = [ + def print_bits(bits, prefix): + if not hasattr(bits, prefix): + return +- print "static const char * const %s_map[%s_MAX + 1] = {" % (prefix, prefix.upper()) +- print " [0 ... %s_MAX] = NULL," % prefix.upper() ++ print ("static const char * const %s_map[%s_MAX + 1] = {" % (prefix, prefix.upper())) ++ print (" [0 ... %s_MAX] = NULL," % prefix.upper()) + for val, name in getattr(bits, prefix).items(): +- print " [%s] = \"%s\"," % (name, name) +- print "};" +- print "" ++ print (" [%s] = \"%s\"," % (name, name)) ++ print ("};") ++ print ("") + + def print_python_bits(bits, prefix): + if not hasattr(bits, prefix): + return + +- print "%s_map = {" % (prefix) ++ print ("%s_map = {" % (prefix)) + for val, name in getattr(bits, prefix).items(): +- print " %d : \"%s\"," % (val, name) +- print "}" +- print "for k, v in %s_map.items():" % (prefix) +- print " %s_map[v] = k" % (prefix) +- print "" ++ print (" %d : \"%s\"," % (val, name)) ++ print ("}") ++ print ("for k, v in %s_map.items():" % (prefix)) ++ print (" %s_map[v] = k" % (prefix)) ++ print ("") + + def print_map(bits): +- print "static const char * const * const map[EV_MAX + 1] = {" +- print " [0 ... EV_MAX] = NULL," ++ print ("static const char * const * const map[EV_MAX + 1] = {") ++ print (" [0 ... EV_MAX] = NULL,") + + for prefix in prefixes: + if prefix == "BTN_" or prefix == "EV_" or prefix == "INPUT_PROP_": + continue +- print " [EV_%s] = %s_map," % (prefix[:-1], prefix[:-1].lower()) ++ print (" [EV_%s] = %s_map," % (prefix[:-1], prefix[:-1].lower())) + +- print "};" +- print "" ++ print ("};") ++ print ("") + + def print_python_map(bits): +- print "map = {" ++ print ("map = {") + + for val, name in getattr(bits, "ev").items(): + name = name[3:] + if name == "REP" or name == "PWR" or name == "FF_STATUS" or name == "MAX": + continue +- print " %d : %s_map," % (val, name.lower()) ++ print (" %d : %s_map," % (val, name.lower())) + +- print "}" +- print "" ++ print ("}") ++ print ("") + + def print_mapping_table(bits): +- print "/* THIS FILE IS GENERATED, DO NOT EDIT */" +- print "" +- print "#ifndef EVENT_NAMES_H" +- print "#define EVENT_NAMES_H" +- print "" +- print "#ifndef SYN_MAX" +- print "#define SYN_MAX 3 /* linux/input.h doesn't define that */" +- print "#endif" +- print "" ++ print ("/* THIS FILE IS GENERATED, DO NOT EDIT */") ++ print ("") ++ print ("#ifndef EVENT_NAMES_H") ++ print ("#define EVENT_NAMES_H") ++ print ("") ++ print ("#ifndef SYN_MAX") ++ print ("#define SYN_MAX 3 /* linux/input.h doesn't define that */") ++ print ("#endif") ++ print ("") + + for prefix in prefixes: + if prefix == "BTN_": +@@ -105,19 +105,19 @@ def print_mapping_table(bits): + + print_map(bits) + +- print "static const char * event_get_type_name(int type) {" +- print " return ev_map[type];" +- print " }" +- print "" +- print "static const char * event_get_code_name(int type, int code) {" +- print " return map[type] ? map[type][code] : NULL;" +- print "}" +- print "" +- print "#endif /* EVENT_NAMES_H */" ++ print ("static const char * event_get_type_name(int type) {") ++ print (" return ev_map[type];") ++ print (" }") ++ print ("") ++ print ("static const char * event_get_code_name(int type, int code) {") ++ print (" return map[type] ? map[type][code] : NULL;") ++ print ("}") ++ print ("") ++ print ("#endif /* EVENT_NAMES_H */") + + def print_python_mapping_table(bits): +- print "# THIS FILE IS GENERATED, DO NOT EDIT" +- print "" ++ print ("# THIS FILE IS GENERATED, DO NOT EDIT") ++ print ("") + + for prefix in prefixes: + if prefix == "BTN_": +@@ -126,15 +126,15 @@ def print_python_mapping_table(bits): + + print_python_map(bits) + +- print "def event_get_type_name(type):" +- print " return ev_map[type]" +- print "" +- print "" +- print "def event_get_code_name(type, code):" +- print " if map.has_key(type) and map[type].has_key(code):" +- print " return map[type][code]" +- print " return 'UNKNOWN'" +- print "" ++ print ("def event_get_type_name(type):") ++ print (" return ev_map[type]") ++ print ("") ++ print ("") ++ print ("def event_get_code_name(type, code):") ++ print (" if map.has_key(type) and map[type].has_key(code):") ++ print (" return map[type][code]") ++ print (" return 'UNKNOWN'") ++ print ("") + + def parse_define(bits, line): + m = re.match(r"^#define\s+(\w+)\s+(\w+)", line) +-- +1.8.1.4 +
Signature · 1 line
1.8.1.4
PATCH 1/1 evemu: fix make-event-names.py for python3 syntax
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Peter" == Peter Seiderer <[email protected]> writes:
Signed-off-by Peter Seiderer <[email protected]>--- ...-event-names-fix-for-python3-print-syntax.patch | 162 +++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 package/evemu/evemu-0004-make-event-names-fix-for-python3-print-syntax.patch
Committed, thanks - But as I mentioned, this only fixes part of the problem.
evemu also comes with python support code, and that code:
- Gets unconditionally built/installed even if you don't have python on the target
- Is incompatible with python3:
Byte-compiling python modules...evemu/base.py File "/usr/lib/python3.4/site-packages/evemu/base.py", line 22
raise exception.ExecutionError, "%s: %s" % (
^SyntaxError: invalid syntax
evemu/const.pyevemu/exception.pyevemu/__init__.py
Byte-compiling python modules (optimized versions) ... evemu/base.pyevemu/const.pyevemu/exception.pyevemu/__init__.py
make[4]: Leaving directory `/home/peko/source/buildroot/output/build/evemu-1.2.0/python'
It would be good you could patch the package to add a configure argument to enable/disable the python stuff and then change it to only enable it if BR2_PACKAGE_PYTHON is enabled.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 1/1 evemu: fix make-event-names.py for python3 syntax
Hello Peter,
Quoted 22 lines
Gesendet: Sonntag, 27. April 2014 um 22:28 Uhr
Von: "Peter Korsgaard" <[email protected]>
An: "Peter Seiderer" <[email protected]>
Cc: buildroot at busybox.net, "Peter Korsgaard" <[email protected]>
Betreff: Re: [PATCH] evemu: fixmake-event-names.pyfor python3 syntaxQuoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Peter" == Peter Seiderer <[email protected]> writes:
Signed-off-by Peter Seiderer <[email protected]>--- ...-event-names-fix-for-python3-print-syntax.patch | 162 +++++++++++++++++++++ 1 file changed, 162 insertions(+) create mode 100644 package/evemu/evemu-0004-make-event-names-fix-for-python3-print-syntax.patchCommitted, thanks - But as I mentioned, this only fixes part of the problem.
evemu also comes with python support code, and that code:
- Gets unconditionally built/installed even if you don't have python on the target
Quoted 8 lines
- Is incompatible with python3:
Byte-compiling python modules...
evemu/base.pyFile "/usr/lib/python3.4/site-packages/evemu/base.py", line 22raise exception.ExecutionError, "%s: %s" % ( ^SyntaxError: invalid syntax
Yes, there is already a debian patch for this problem...
Quoted 10 lines
evemu/const.pyevemu/exception.pyevemu/__init__.py
Byte-compiling python modules (optimized versions) ...evemu/base.pyevemu/const.pyevemu/exception.pyevemu/__init__.py
make[4]: Leaving directory `/home/peko/source/buildroot/output/build/evemu-1.2.0/python'It would be good you could patch the package to add a configure argument to enable/disable the python stuff and then change it to only enable it if
BR2_PACKAGE_PYTHONis enabled.
Will prepare a patch soon (even earlier, but something seems to have broken the python3 byte-compile on my buildroot configuration, still investigating....)...
Regards,
Peter
Quoted 4 lines
Signature · 2 lines
-- Bye, Peter Korsgaard