diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2022-10-19 21:16:04 +0200 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2022-10-19 22:46:30 +0200 |
commit | ee8d57df44c7dee17088efa28f33285516304dd6 (patch) | |
tree | b2203bf6c8cd5c30589c7479ef615045e87c214b /hwdb.d/parse_hwdb.py | |
parent | dacaddd90a5f991e4e1099b200cf0d1565aa023e (diff) | |
download | systemd-ee8d57df44c7dee17088efa28f33285516304dd6.tar.gz |
test: make parse-hwdb compatible with older pyparsing versions
Follow-up to e77fed207a41a77f88853a89a8408fbfa9a17ddd.
Diffstat (limited to 'hwdb.d/parse_hwdb.py')
-rwxr-xr-x | hwdb.d/parse_hwdb.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/hwdb.d/parse_hwdb.py b/hwdb.d/parse_hwdb.py index 61932fb018..899d8f6072 100755 --- a/hwdb.d/parse_hwdb.py +++ b/hwdb.d/parse_hwdb.py @@ -33,12 +33,23 @@ try: OneOrMore, Combine, Or, Optional, Suppress, Group, nums, alphanums, printables, stringEnd, pythonStyleComment, - ParseBaseException, __diag__) + ParseBaseException) except ImportError: print('pyparsing is not available') sys.exit(77) try: + from pyparsing import __diag__ + + __diag__.warn_multiple_tokens_in_named_alternation = True + __diag__.warn_ungrouped_named_tokens_in_collection = True + __diag__.warn_name_set_on_empty_Forward = True + __diag__.warn_on_multiple_string_args_to_oneof = True + __diag__.enable_debug_on_named_expressions = True +except ImportError: + pass + +try: from evdev.ecodes import ecodes except ImportError: ecodes = None @@ -50,12 +61,6 @@ except ImportError: # don't do caching on old python lru_cache = lambda: (lambda f: f) -__diag__.warn_multiple_tokens_in_named_alternation = True -__diag__.warn_ungrouped_named_tokens_in_collection = True -__diag__.warn_name_set_on_empty_Forward = True -__diag__.warn_on_multiple_string_args_to_oneof = True -__diag__.enable_debug_on_named_expressions = True - EOL = LineEnd().suppress() EMPTYLINE = LineEnd() COMMENTLINE = pythonStyleComment + EOL |