summaryrefslogtreecommitdiff
path: root/test/rule-syntax-check.py
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-11-22 12:29:46 +0100
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-11-22 12:29:58 +0100
commit2956395c83ced766e989a53350293fdc62836178 (patch)
tree7774344dd914fc5dfca1b43c0fb8f42dbbb30604 /test/rule-syntax-check.py
parentbfbcf21d75f103e639a7d18691b3f2a334b7e6f7 (diff)
downloadsystemd-2956395c83ced766e989a53350293fdc62836178.tar.gz
rule-test-syntax: modernize syntax and add debug message
Diffstat (limited to 'test/rule-syntax-check.py')
-rwxr-xr-xtest/rule-syntax-check.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/test/rule-syntax-check.py b/test/rule-syntax-check.py
index 4f27fb015b..7c69c489cb 100755
--- a/test/rule-syntax-check.py
+++ b/test/rule-syntax-check.py
@@ -32,7 +32,7 @@ else:
root_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
rules_dir = os.path.join(os.environ.get('top_srcdir', root_dir), 'rules')
if not os.path.isdir(rules_dir):
- sys.stderr.write('No rules files given, and %s does not exist, aborting' % rules_dir)
+ print('No rules files given, and {} does not exist, aborting'.format(rules_dir), file=sys.stderr)
sys.exit(2)
rules_files = glob(os.path.join(rules_dir, '*.rules'))
@@ -44,6 +44,7 @@ args_assign = re.compile(r'(ATTR|ENV|IMPORT|RUN){([a-zA-Z0-9/_.*%-]+)}\s*(=|\+=)
result = 0
buffer = ''
for path in rules_files:
+ print('# looking at {}'.format(path))
lineno = 0
for line in open(path):
lineno += 1
@@ -66,9 +67,9 @@ for path in rules_files:
if not (no_args_tests.match(clause) or args_tests.match(clause) or
no_args_assign.match(clause) or args_assign.match(clause)):
- print('Invalid line %s:%i: %s' % (path, lineno, line))
- print(' clause: %s' % clause)
- print('')
+ print('Invalid line {}:{}: {}'.format(path, lineno, line))
+ print(' clause:', clause)
+ print()
result = 1
break