From fa3d9573ceb93ac314423b850731b04b855edde2 Mon Sep 17 00:00:00 2001 From: Brian Pugh Date: Wed, 13 May 2020 15:13:32 -0700 Subject: [PATCH] tools/idf.py: prevent reloading duplicate extension paths. Do not load cwd if IDF_EXTRA_ACTIONS_PATH is not set. Merges https://github.com/espressif/esp-idf/pull/5278 --- tools/idf.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tools/idf.py b/tools/idf.py index 118ff5c30..c543316df 100755 --- a/tools/idf.py +++ b/tools/idf.py @@ -635,10 +635,15 @@ def init_cli(verbose_output=None): all_actions = {} # Load extensions from components dir idf_py_extensions_path = os.path.join(os.environ["IDF_PATH"], "tools", "idf_py_actions") - extra_paths = os.environ.get("IDF_EXTRA_ACTIONS_PATH", "").split(';') - extension_dirs = [idf_py_extensions_path] + extra_paths - extensions = {} + extension_dirs = [realpath(idf_py_extensions_path)] + extra_paths = os.environ.get("IDF_EXTRA_ACTIONS_PATH") + if extra_paths is not None: + for path in extra_paths.split(';'): + path = realpath(path) + if path not in extension_dirs: + extension_dirs.append(path) + extensions = {} for directory in extension_dirs: if directory and not os.path.exists(directory): print('WARNING: Directroy with idf.py extensions doesn\'t exist:\n %s' % directory)