Tools: Download the Python constraint file less frequently

pull/8284/head
Roland Dobai 2022-01-18 14:49:53 +01:00
rodzic 0265c79bcc
commit 1a9398799c
1 zmienionych plików z 11 dodań i 0 usunięć

Wyświetl plik

@ -31,6 +31,7 @@
import argparse
import contextlib
import copy
import datetime
import errno
import functools
import hashlib
@ -1517,6 +1518,16 @@ def get_constraints(idf_version): # type: (str) -> str
mkdir_p(os.path.dirname(temp_path))
try:
age = datetime.date.today() - datetime.date.fromtimestamp(os.path.getmtime(constraint_path))
if age < datetime.timedelta(days=1):
info(f'Skipping the download of {constraint_path} because it was downloaded recently. If you believe '
f'that this is causing you trouble then remove it manually and re-run your install script.')
return constraint_path
except OSError:
# doesn't exist or inaccessible
pass
for _ in range(DOWNLOAD_RETRY_COUNT):
download(constraint_url, temp_path)
if not os.path.isfile(temp_path):