diff options
-rw-r--r-- | mesonbuild/interpreter.py | 2 | ||||
-rw-r--r-- | test cases/common/14 configure file/check_file.py | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index d824e3c..09f7ff5 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -4006,7 +4006,7 @@ This will become a hard error in the future.''' % kwargs['input'], location=self raise InterpreterException('Exactly one input file must be given in copy mode') os.makedirs(os.path.join(self.environment.build_dir, self.subdir), exist_ok=True) shutil.copyfile(inputs_abs[0], ofile_abs) - shutil.copymode(inputs_abs[0], ofile_abs) + shutil.copystat(inputs_abs[0], ofile_abs) else: # Not reachable raise AssertionError diff --git a/test cases/common/14 configure file/check_file.py b/test cases/common/14 configure file/check_file.py index 6aa73e0..707995e 100644 --- a/test cases/common/14 configure file/check_file.py +++ b/test cases/common/14 configure file/check_file.py @@ -6,9 +6,15 @@ import sys if len(sys.argv) == 2: assert(os.path.exists(sys.argv[1])) elif len(sys.argv) == 3: - f1 = open(sys.argv[1], 'rb').read() - f2 = open(sys.argv[2], 'rb').read() - if f1 != f2: + f1 = sys.argv[1] + f2 = sys.argv[2] + m1 = os.stat(f1).st_mtime_ns + m2 = os.stat(f2).st_mtime_ns + # Compare only os.stat() + if m1 != m2: + raise RuntimeError('mtime of {!r} () != mtime of {!r} ()'.format(f1, m1, f2, m2)) + import filecmp + if not filecmp.cmp(f1, f2): raise RuntimeError('{!r} != {!r}'.format(f1, f2)) else: raise AssertionError |