Tools: Download the Python constraint file less frequently
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):
