1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
#!/usr/bin/python
import sys
inputs = [
("ql.dist.diff", "Some Makefile.am"),
("test-suite.dist.diff", "test-suite/Makefile.am"),
("ql.cmake.diff", "ql/CMakeLists.txt"),
("test-suite.cmake.diff", "test-suite/CMakeLists.txt"),
("ql.vcx.diff", "QuantLib.vcxproj"),
("ql.vcx.filters.diff", "QuantLib.vcxproj.filters"),
("test-suite.vcx.diff", "test-suite/testsuite.vcxproj"),
("test-suite.vcx.filters.diff", "test-suite/testsuite.vcxproj.filters"),
]
result = 0
def format(line):
filename = line[2:].strip()
if filename.endswith(".hpp"):
return "header file %s" % filename
elif filename.endswith(".cpp"):
return "source file %s" % filename
else:
return "file %s" % filename
CYAN = "\033[96m"
RED = "\033[91m"
GREEN = "\033[92m"
BOLD = "\033[1m"
RESET = "\033[0m"
print(BOLD + CYAN + "\n=============================== RESULTS ================================\n" + RESET)
for diffs, target in inputs:
with open(diffs) as f:
for line in f:
if line.startswith("< "):
print(RED + "%s contains extra %s" % (target, format(line)) + RESET)
result = 1
if line.startswith("> "):
print(RED + "%s doesn't contain %s" % (target, format(line)) + RESET)
result = 1
if result == 0:
print(GREEN + "All clear." + RESET)
sys.exit(result)
|