From a0a969c9719a4a79b893736638371216cc6a8e3b Mon Sep 17 00:00:00 2001 From: Roland Dobai Date: Mon, 8 Aug 2022 09:43:31 +0200 Subject: [PATCH] Tools: Detect missing component manager and print proper error message --- tools/idf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/idf.py b/tools/idf.py index 2a705e556d..0b91e13ff0 100755 --- a/tools/idf.py +++ b/tools/idf.py @@ -39,6 +39,8 @@ try: from idf_py_actions.errors import FatalError # noqa: E402 from idf_py_actions.tools import (PropertyDict, executable_exists, get_target, idf_version, # noqa: E402 merge_action_lists, realpath) + if os.getenv('IDF_COMPONENT_MANAGER') != '0': + from idf_component_manager import idf_extensions except ImportError: # For example, importing click could cause this. print('Please use idf.py only in an ESP-IDF shell environment.', file=sys.stderr) @@ -672,7 +674,6 @@ def init_cli(verbose_output: List=None) -> Any: # Load component manager idf.py extensions if not explicitly disabled if os.getenv('IDF_COMPONENT_MANAGER') != '0': - from idf_component_manager import idf_extensions extensions.append(('component_manager_ext', idf_extensions)) # Optional load `pyclang` for additional clang-tidy related functionalities