Skip to content

Commit b46d6b1

Browse files
authored
remove hard coding of IDF_TOOLS_PATH and set path to PROJECT_CORE_DIR (#263)
* Update tool-esp_install-v5.3.1 * set IDF_TOOLS_PATH to path of PROJECT_CORE_DIR
1 parent d0d3e38 commit b46d6b1

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

platform.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@
9999
"type": "tool",
100100
"optional": false,
101101
"owner": "pioarduino",
102-
"package-version": "5.3.0",
103-
"version": "https://github.com/pioarduino/esp_install/releases/download/v5.3.0/esp_install-v5.3.0.zip"
102+
"package-version": "5.3.1",
103+
"version": "https://github.com/pioarduino/esp_install/releases/download/v5.3.1/esp_install-v5.3.1.zip"
104104
},
105105
"contrib-piohome": {
106106
"optional": true,

platform.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,10 @@
7777
if IS_WINDOWS:
7878
os.environ["PLATFORMIO_SYSTEM_TYPE"] = "windows_amd64"
7979

80-
# Clear IDF_TOOLS_PATH, if set tools may be installed in the wrong place
81-
os.environ["IDF_TOOLS_PATH"] = ""
80+
# Set IDF_TOOLS_PATH to Pio core_dir
81+
PROJECT_CORE_DIR=ProjectConfig.get_instance().get("platformio", "core_dir")
82+
IDF_TOOLS_PATH=os.path.join(PROJECT_CORE_DIR)
83+
os.environ["IDF_TOOLS_PATH"] = IDF_TOOLS_PATH
8284

8385
# Global variables
8486
python_exe = get_pythonexe_path()
@@ -478,19 +480,16 @@ def _install_with_idf_tools(self, tool_name: str, paths: Dict[str, str]) -> bool
478480
return False
479481

480482
# Copy tool files
481-
tools_path_default = os.path.join(
482-
os.path.expanduser("~"), ".platformio"
483-
)
484483
target_package_path = os.path.join(
485-
tools_path_default, "tools", tool_name, "package.json"
484+
IDF_TOOLS_PATH, "tools", tool_name, "package.json"
486485
)
487486

488487
if not safe_copy_file(paths['package_path'], target_package_path):
489488
return False
490489

491490
safe_remove_directory(paths['tool_path'])
492491

493-
tl_path = f"file://{os.path.join(tools_path_default, 'tools', tool_name)}"
492+
tl_path = f"file://{os.path.join(IDF_TOOLS_PATH, 'tools', tool_name)}"
494493
pm.install(tl_path)
495494

496495
logger.info(f"Tool {tool_name} successfully installed")

0 commit comments

Comments
 (0)