mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Merge branch 'feature/tools_py_constrain_download_improvement' into 'master'
Tools: Don't check Python dependencies at every idf.py and cmake run and download the constraint file less frequently Closes IDF-4578 See merge request espressif/esp-idf!16849
This commit is contained in:
commit
309c1113f4
@ -273,27 +273,6 @@ function(__build_write_properties output_file)
|
|||||||
file(WRITE ${output_file} "${build_properties_text}")
|
file(WRITE ${output_file} "${build_properties_text}")
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
#
|
|
||||||
# Check if the Python interpreter used for the build has all the required modules.
|
|
||||||
#
|
|
||||||
function(__build_check_python)
|
|
||||||
idf_build_get_property(check __CHECK_PYTHON)
|
|
||||||
if(check)
|
|
||||||
idf_build_get_property(python PYTHON)
|
|
||||||
idf_build_get_property(idf_path IDF_PATH)
|
|
||||||
message(STATUS "Checking Python dependencies...")
|
|
||||||
execute_process(COMMAND "${python}" "${idf_path}/tools/idf_tools.py" "check-python-dependencies"
|
|
||||||
RESULT_VARIABLE result)
|
|
||||||
if(result EQUAL 1)
|
|
||||||
# check_python_dependencies returns error code 1 on failure
|
|
||||||
message(FATAL_ERROR "Some Python dependencies must be installed. Check above message for details.")
|
|
||||||
elseif(NOT result EQUAL 0)
|
|
||||||
# means check_python_dependencies.py failed to run at all, result should be an error message
|
|
||||||
message(FATAL_ERROR "Failed to run Python dependency check. Python: ${python}, Error: ${result}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Prepare for component processing expanding each component's project include
|
# Prepare for component processing expanding each component's project include
|
||||||
#
|
#
|
||||||
@ -414,9 +393,6 @@ macro(idf_build_process target)
|
|||||||
|
|
||||||
__build_set_default(SDKCONFIG_DEFAULTS "")
|
__build_set_default(SDKCONFIG_DEFAULTS "")
|
||||||
|
|
||||||
# Check for required Python modules
|
|
||||||
__build_check_python()
|
|
||||||
|
|
||||||
idf_build_get_property(target IDF_TARGET)
|
idf_build_get_property(target IDF_TARGET)
|
||||||
|
|
||||||
if(NOT "${target}" STREQUAL "linux")
|
if(NOT "${target}" STREQUAL "linux")
|
||||||
|
18
tools/idf.py
18
tools/idf.py
@ -89,24 +89,6 @@ def check_environment():
|
|||||||
except RuntimeError as e:
|
except RuntimeError as e:
|
||||||
raise FatalError(e)
|
raise FatalError(e)
|
||||||
|
|
||||||
# check Python dependencies
|
|
||||||
checks_output.append('Checking Python dependencies...')
|
|
||||||
try:
|
|
||||||
out = subprocess.check_output(
|
|
||||||
[
|
|
||||||
os.environ['PYTHON'],
|
|
||||||
os.path.join(os.environ['IDF_PATH'], 'tools', 'idf_tools.py'),
|
|
||||||
'check-python-dependencies',
|
|
||||||
],
|
|
||||||
env=os.environ,
|
|
||||||
)
|
|
||||||
|
|
||||||
checks_output.append(out.decode('utf-8', 'ignore').strip())
|
|
||||||
except subprocess.CalledProcessError as e:
|
|
||||||
print_warning(e.output.decode('utf-8', 'ignore'), stream=sys.stderr)
|
|
||||||
debug_print_idf_version()
|
|
||||||
raise SystemExit(1)
|
|
||||||
|
|
||||||
return checks_output
|
return checks_output
|
||||||
|
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import contextlib
|
import contextlib
|
||||||
import copy
|
import copy
|
||||||
|
import datetime
|
||||||
import errno
|
import errno
|
||||||
import functools
|
import functools
|
||||||
import hashlib
|
import hashlib
|
||||||
@ -1517,6 +1518,16 @@ def get_constraints(idf_version): # type: (str) -> str
|
|||||||
|
|
||||||
mkdir_p(os.path.dirname(temp_path))
|
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):
|
for _ in range(DOWNLOAD_RETRY_COUNT):
|
||||||
download(constraint_url, temp_path)
|
download(constraint_url, temp_path)
|
||||||
if not os.path.isfile(temp_path):
|
if not os.path.isfile(temp_path):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user