download-build: preserve build artefacts last modification time

This commit is contained in:
Yanko Kaneti 2023-02-23 22:53:55 +02:00 committed by Tomas Kopecek
parent f6f808bca7
commit d520dce8a2

View file

@ -607,6 +607,11 @@ def download_file(url, relpath, quiet=False, noprogress=False, size=None,
_download_progress(length, pos, filesize)
if not length and not (quiet or noprogress):
_download_progress(pos, pos, filesize)
last_modified = response.headers.get('last-modified')
if last_modified:
mtime = dateutil.parser.parse(last_modified)
if mtime:
os.utime(relpath, (time.time() ,time.mktime(mtime.astimezone().timetuple())))
finally:
f.close()
if pos == 0: