system-config/tools/sorted_modules_env.py
Spencer Krum 1f0704e462 Alpha-sort modules.env
Also adds a test to ensure that they stay that way.

Change-Id: Ib34a81885f1eda28e85d04b727e8b810b274cb44
2015-07-02 12:25:24 -07:00

25 lines
500 B
Python

#!/usr/bin/env
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)