system-config/tools/sorted_modules_env.py
Ian Wienand c807245d8b tools/sorted_modules.py : make python3 safe
Trivial updates to print statements only

Change-Id: I633c21a226364d045fc1650cb41b79b83988d7db
2018-06-22 11:47:39 +10:00

25 lines
509 B
Python

#!/usr/bin/env python
import sys
import difflib
def assert_sorted(lines):
if lines == sorted(lines):
return True
else:
print("Modules not sorted:")
for line in difflib.context_diff(lines, sorted(lines)):
print(line)
sys.exit(1)
with open(sys.argv[1]) as f:
lines = f.readlines()
integration = [i for i in lines if i.startswith('INTEGRATION')]
source = [i for i in lines if i.startswith('SOURCE')]
assert_sorted(integration)
assert_sorted(source)