diff options
author | David Robillard <d@drobilla.net> | 2019-03-18 13:05:08 +0100 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2019-03-18 13:14:48 +0100 |
commit | 7dfab2315ff4154a382d679f9e9c8943d036e107 (patch) | |
tree | 028b7f7e2632050e7465a266e73abbecfe4c29e6 /waflib/extras/autowaf.py | |
parent | ea9e3614ce1bc4fcb8e6fdb05f7b071d6d043c6d (diff) | |
download | serd-7dfab2315ff4154a382d679f9e9c8943d036e107.tar.gz serd-7dfab2315ff4154a382d679f9e9c8943d036e107.tar.bz2 serd-7dfab2315ff4154a382d679f9e9c8943d036e107.zip |
Pass file comparison test if difflib finds no changes
The Python filecmp module seems to be a bit flaky on some platforms, so with
this change the test only fails if actual visible changes are printed.
Diffstat (limited to 'waflib/extras/autowaf.py')
-rw-r--r-- | waflib/extras/autowaf.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/waflib/extras/autowaf.py b/waflib/extras/autowaf.py index c28cc1aa..d7799670 100644 --- a/waflib/extras/autowaf.py +++ b/waflib/extras/autowaf.py @@ -807,11 +807,15 @@ def show_diff(from_lines, to_lines, from_filename, to_filename): import difflib import sys + same = True for line in difflib.unified_diff( from_lines, to_lines, fromfile=os.path.abspath(from_filename), tofile=os.path.abspath(to_filename)): sys.stderr.write(line) + same = False + + return same def test_file_equals(patha, pathb): import filecmp @@ -827,9 +831,7 @@ def test_file_equals(patha, pathb): with io.open(patha, 'rU', encoding='utf-8') as fa: with io.open(pathb, 'rU', encoding='utf-8') as fb: - show_diff(fa.readlines(), fb.readlines(), patha, pathb) - - return False + return show_diff(fa.readlines(), fb.readlines(), patha, pathb) def bench_time(): if hasattr(time, 'perf_counter'): # Added in Python 3.3 |