From 7dcef1dca465aeaae3e793279ce4b6c5463b7a1c Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Wed, 22 Mar 2023 11:54:15 +0200 Subject: [PATCH] aedi: `BuildTarget.update_text_file()` restores modification time after write the primary reason for this change is to avoid update of files at build step when these files were created at configuration step --- aedi/target/base.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aedi/target/base.py b/aedi/target/base.py index 22297904..64a86c15 100644 --- a/aedi/target/base.py +++ b/aedi/target/base.py @@ -131,9 +131,13 @@ class BuildTarget(Target): if content == patched_content: return + file_time = os.stat(path).st_mtime + with open(path, 'w') as f: f.writelines(patched_content) + os.utime(path, (file_time, file_time)) + @staticmethod def _update_variables_file(path: Path, prefix_value: str, processor: typing.Optional[typing.Callable] = None, quotes: bool = True):