1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2024-12-24 21:34:08 +03:00

test: make parse-hwdb compatible with older pyparsing versions

Follow-up to e77fed207a.
This commit is contained in:
Frantisek Sumsal 2022-10-19 21:16:04 +02:00
parent dacaddd90a
commit ee8d57df44

View File

@ -33,11 +33,22 @@ try:
OneOrMore, Combine, Or, Optional, Suppress, Group, OneOrMore, Combine, Or, Optional, Suppress, Group,
nums, alphanums, printables, nums, alphanums, printables,
stringEnd, pythonStyleComment, stringEnd, pythonStyleComment,
ParseBaseException, __diag__) ParseBaseException)
except ImportError: except ImportError:
print('pyparsing is not available') print('pyparsing is not available')
sys.exit(77) 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: try:
from evdev.ecodes import ecodes from evdev.ecodes import ecodes
except ImportError: except ImportError:
@ -50,12 +61,6 @@ except ImportError:
# don't do caching on old python # don't do caching on old python
lru_cache = lambda: (lambda f: f) 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() EOL = LineEnd().suppress()
EMPTYLINE = LineEnd() EMPTYLINE = LineEnd()
COMMENTLINE = pythonStyleComment + EOL COMMENTLINE = pythonStyleComment + EOL