aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-10-21 19:07:33 +0200
committerDavid Robillard <d@drobilla.net>2018-10-28 14:25:43 +0100
commit6a26f8accd2c40151095adb35792fa35681a1f53 (patch)
treecd215faf96129aa56189d1700216cb0487d45e01
parent64ee2972b328ef93553f84a813216b787b358f8f (diff)
downloadserd-6a26f8accd2c40151095adb35792fa35681a1f53.tar.gz
serd-6a26f8accd2c40151095adb35792fa35681a1f53.tar.bz2
serd-6a26f8accd2c40151095adb35792fa35681a1f53.zip
Show diffs for all failed file equality checks
-rw-r--r--wscript16
1 files changed, 9 insertions, 7 deletions
diff --git a/wscript b/wscript
index 39c240b1..ecba9ad3 100644
--- a/wscript
+++ b/wscript
@@ -221,6 +221,12 @@ def file_equals(patha, pathb, subst_from='', subst_to=''):
lineb = fb.readline()
if (linea.replace(subst_from, subst_to) !=
lineb.replace(subst_from, subst_to)):
+ fa.seek(0)
+ fb.seek(0)
+ show_diff(fa.readlines(),
+ fb.readlines(),
+ patha,
+ pathb)
return False
return True
@@ -255,7 +261,9 @@ def show_diff(from_lines, to_lines, from_filename, to_filename):
import sys
for line in difflib.unified_diff(
- from_lines, to_lines, fromfile=from_filename, tofile=to_filename):
+ from_lines, to_lines,
+ fromfile=os.path.abspath(from_filename),
+ tofile=os.path.abspath(to_filename)):
sys.stderr.write(line)
def check_output(out_filename, check_filename, subst_from='', subst_to=''):
@@ -264,12 +272,6 @@ def check_output(out_filename, check_filename, subst_from='', subst_to=''):
elif not file_equals(check_filename, out_filename, subst_from, subst_to):
Logs.pprint('RED', 'FAIL: %s != %s' % (os.path.abspath(out_filename),
check_filename))
- with io.open(out_filename, encoding='utf-8') as out_file:
- with io.open(check_filename, encoding='utf-8') as check_file:
- show_diff(check_file.readlines(),
- out_file.readlines(),
- check_filename,
- out_filename)
else:
return True