diff --git a/tools/idf_tools.py b/tools/idf_tools.py index 9ce3f9f64b..1670ade1b0 100755 --- a/tools/idf_tools.py +++ b/tools/idf_tools.py @@ -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):