Better support for file contents writing // Issue #2796

This commit is contained in:
Ivan Kravets
2019-10-17 18:48:59 +03:00
parent 7bcfea13fb
commit 6218b773fd
14 changed files with 80 additions and 91 deletions

View File

@@ -220,14 +220,12 @@ def is_prog_obsolete(prog_path):
break
shasum.update(data)
new_digest = shasum.hexdigest()
old_digest = None
if isfile(prog_hash_path):
with open(prog_hash_path, "r") as fp:
old_digest = fp.read()
old_digest = (
fs.get_file_contents(prog_hash_path) if isfile(prog_hash_path) else None
)
if new_digest == old_digest:
return False
with open(prog_hash_path, "w") as fp:
fp.write(new_digest)
fs.write_file_contents(prog_hash_path, new_digest)
return True