|
71 | 71 | IS_WINDOWS = sys.platform.startswith("win") |
72 | 72 | # Set Platformio env var to use windows_amd64 for all windows architectures |
73 | 73 | # only windows_amd64 native espressif toolchains are available |
74 | | -# needs platformio/pioarduino core >= 6.1.17 |
75 | 74 | if IS_WINDOWS: |
76 | 75 | os.environ["PLATFORMIO_SYSTEM_TYPE"] = "windows_amd64" |
77 | 76 |
|
78 | | -# Clear IDF_TOOLS_PATH, if set tools may be installed in the wrong place |
79 | | -os.environ["IDF_TOOLS_PATH"] = "" |
| 77 | +# Set IDF_TOOLS_PATH to Pio core_dir |
| 78 | +PROJECT_CORE_DIR=ProjectConfig.get_instance().get("platformio", "core_dir") |
| 79 | +IDF_TOOLS_PATH=os.path.join(PROJECT_CORE_DIR) |
| 80 | +os.environ["IDF_TOOLS_PATH"] = IDF_TOOLS_PATH |
80 | 81 |
|
81 | 82 | # Global variables |
82 | 83 | python_exe = get_pythonexe_path() |
@@ -468,19 +469,17 @@ def _install_with_idf_tools(self, tool_name: str, paths: Dict[str, str]) -> bool |
468 | 469 | return False |
469 | 470 |
|
470 | 471 | # Copy tool files |
471 | | - tools_path_default = os.path.join( |
472 | | - os.path.expanduser("~"), ".platformio" |
473 | 472 | ) |
474 | 473 | target_package_path = os.path.join( |
475 | | - tools_path_default, "tools", tool_name, "package.json" |
| 474 | + IDF_TOOLS_PATH, "tools", tool_name, "package.json" |
476 | 475 | ) |
477 | 476 |
|
478 | 477 | if not safe_copy_file(paths['package_path'], target_package_path): |
479 | 478 | return False |
480 | 479 |
|
481 | 480 | safe_remove_directory(paths['tool_path']) |
482 | 481 |
|
483 | | - tl_path = f"file://{os.path.join(tools_path_default, 'tools', tool_name)}" |
| 482 | + tl_path = f"file://{os.path.join(IDF_TOOLS_PATH, 'tools', tool_name)}" |
484 | 483 | pm.install(tl_path) |
485 | 484 |
|
486 | 485 | logger.info(f"Tool {tool_name} successfully installed") |
|
0 commit comments