0e9a9b9f6e
It is obviously missing "python" which makes it not possible to run on its own. It works with tox because tox.ini explicitly invokes it with "python {toxinidir}/tools/sorted_modules_env.py". Change-Id: I6eab942660d69eacda95572c7d2077687087b7c7
25 lines
507 B
Python
25 lines
507 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)
|