4141from platformio .package .manager .tool import ToolPackageManager
4242
4343# Constants
44- try :
45- with open ('/proc/device-tree/model' ) as f :
46- SUBPROCESS_TIMEOUT = 900 if 'raspberry pi' in f .read ().lower () else 300
47- except :
48- SUBPROCESS_TIMEOUT = 300
49- RETRY_LIMIT = 3
5044DEFAULT_DEBUG_SPEED = "5000"
5145DEFAULT_APP_OFFSET = "0x10000"
5246tl_install_name = "tool-esp_install"
9185if IS_WINDOWS :
9286 os .environ ["PLATFORMIO_SYSTEM_TYPE" ] = "windows_amd64"
9387
88+ # exit without git
89+ if not shutil .which ("git" ):
90+ print ("Git not found in PATH, please install Git." , file = sys .stderr )
91+ print ("Git is needed for Platform espressif32 to work." , file = sys .stderr )
92+ raise SystemExit (1 )
93+
9494# Set IDF_TOOLS_PATH to Pio core_dir
9595PROJECT_CORE_DIR = ProjectConfig .get_instance ().get ("platformio" , "core_dir" )
9696IDF_TOOLS_PATH = os .path .join (PROJECT_CORE_DIR )
9797os .environ ["IDF_TOOLS_PATH" ] = IDF_TOOLS_PATH
98+ os .environ ['IDF_PATH' ] = ""
9899
99100# Global variables
100101python_exe = get_pythonexe_path ()
@@ -385,7 +386,11 @@ def _check_tool_status(self, tool_name: str) -> Dict[str, bool]:
385386 }
386387
387388 def _run_idf_tools_install (self , tools_json_path : str , idf_tools_path : str ) -> bool :
388- """Execute idf_tools.py install command with timeout and error handling."""
389+ """
390+ Execute idf_tools.py install command.
391+ Note: No timeout is set to allow installations to complete on slow networks.
392+ The tool-esp_install handles the retry logic.
393+ """
389394 cmd = [
390395 python_exe ,
391396 idf_tools_path ,
@@ -397,11 +402,11 @@ def _run_idf_tools_install(self, tools_json_path: str, idf_tools_path: str) -> b
397402 ]
398403
399404 try :
405+ logger .info (f"Installing tools via idf_tools.py (this may take several minutes)..." )
400406 result = subprocess .run (
401407 cmd ,
402408 stdout = subprocess .DEVNULL ,
403409 stderr = subprocess .DEVNULL ,
404- timeout = SUBPROCESS_TIMEOUT ,
405410 check = False
406411 )
407412
@@ -412,9 +417,6 @@ def _run_idf_tools_install(self, tools_json_path: str, idf_tools_path: str) -> b
412417 logger .debug ("idf_tools.py executed successfully" )
413418 return True
414419
415- except subprocess .TimeoutExpired :
416- logger .error (f"Timeout in idf_tools.py after { SUBPROCESS_TIMEOUT } s" )
417- return False
418420 except (subprocess .SubprocessError , OSError ) as e :
419421 logger .error (f"Error in idf_tools.py: { e } " )
420422 return False
@@ -454,14 +456,8 @@ def _check_tool_version(self, tool_name: str) -> bool:
454456 logger .error (f"Error reading package data for { tool_name } : { e } " )
455457 return False
456458
457- def install_tool (self , tool_name : str , retry_count : int = 0 ) -> bool :
458- """Install a tool with optimized retry mechanism."""
459- if retry_count >= RETRY_LIMIT :
460- logger .error (
461- f"Installation of { tool_name } failed after { RETRY_LIMIT } attempts"
462- )
463- return False
464-
459+ def install_tool (self , tool_name : str ) -> bool :
460+ """Install a tool."""
465461 self .packages [tool_name ]["optional" ] = False
466462 paths = self ._get_tool_paths (tool_name )
467463 status = self ._check_tool_status (tool_name )
@@ -473,7 +469,7 @@ def install_tool(self, tool_name: str, retry_count: int = 0) -> bool:
473469 # Case 2: Tool already installed, version check
474470 if (status ['has_idf_tools' ] and status ['has_piopm' ] and
475471 not status ['has_tools_json' ]):
476- return self ._handle_existing_tool (tool_name , paths , retry_count )
472+ return self ._handle_existing_tool (tool_name , paths )
477473
478474 logger .debug (f"Tool { tool_name } already configured" )
479475 return True
@@ -501,9 +497,7 @@ def _install_with_idf_tools(self, tool_name: str, paths: Dict[str, str]) -> bool
501497 logger .info (f"Tool { tool_name } successfully installed" )
502498 return True
503499
504- def _handle_existing_tool (
505- self , tool_name : str , paths : Dict [str , str ], retry_count : int
506- ) -> bool :
500+ def _handle_existing_tool (self , tool_name : str , paths : Dict [str , str ]) -> bool :
507501 """Handle already installed tools with version checking."""
508502 if self ._check_tool_version (tool_name ):
509503 # Version matches, use tool
@@ -518,7 +512,7 @@ def _handle_existing_tool(
518512 # Remove the main tool directory (if it still exists after cleanup)
519513 safe_remove_directory (paths ['tool_path' ])
520514
521- return self .install_tool (tool_name , retry_count + 1 )
515+ return self .install_tool (tool_name )
522516
523517 def _configure_arduino_framework (self , frameworks : List [str ]) -> None :
524518 """Configure Arduino framework dependencies."""
0 commit comments