43
43
from platformio .package .manager .tool import ToolPackageManager
44
44
45
45
# Constants
46
- try :
47
- with open ('/proc/device-tree/model' ) as f :
48
- SUBPROCESS_TIMEOUT = 900 if 'raspberry pi' in f .read ().lower () else 300
49
- except :
50
- SUBPROCESS_TIMEOUT = 300
51
- RETRY_LIMIT = 3
52
46
DEFAULT_DEBUG_SPEED = "5000"
53
47
DEFAULT_APP_OFFSET = "0x10000"
54
48
tl_install_name = "tool-esp_install"
@@ -402,7 +396,11 @@ def _check_tool_status(self, tool_name: str) -> Dict[str, bool]:
402
396
}
403
397
404
398
def _run_idf_tools_install (self , tools_json_path : str , idf_tools_path : str ) -> bool :
405
- """Execute idf_tools.py install command with timeout and error handling."""
399
+ """
400
+ Execute idf_tools.py install command.
401
+ Note: No timeout is set to allow installations to complete on slow networks.
402
+ The tool-esp_install handles the retry logic.
403
+ """
406
404
cmd = [
407
405
python_exe ,
408
406
idf_tools_path ,
@@ -414,11 +412,11 @@ def _run_idf_tools_install(self, tools_json_path: str, idf_tools_path: str) -> b
414
412
]
415
413
416
414
try :
415
+ logger .info (f"Installing tools via idf_tools.py (this may take several minutes)..." )
417
416
result = subprocess .run (
418
417
cmd ,
419
418
stdout = subprocess .DEVNULL ,
420
419
stderr = subprocess .DEVNULL ,
421
- timeout = SUBPROCESS_TIMEOUT ,
422
420
check = False
423
421
)
424
422
@@ -429,9 +427,6 @@ def _run_idf_tools_install(self, tools_json_path: str, idf_tools_path: str) -> b
429
427
logger .debug ("idf_tools.py executed successfully" )
430
428
return True
431
429
432
- except subprocess .TimeoutExpired :
433
- logger .error (f"Timeout in idf_tools.py after { SUBPROCESS_TIMEOUT } s" )
434
- return False
435
430
except (subprocess .SubprocessError , OSError ) as e :
436
431
logger .error (f"Error in idf_tools.py: { e } " )
437
432
return False
@@ -471,14 +466,8 @@ def _check_tool_version(self, tool_name: str) -> bool:
471
466
logger .error (f"Error reading package data for { tool_name } : { e } " )
472
467
return False
473
468
474
- def install_tool (self , tool_name : str , retry_count : int = 0 ) -> bool :
475
- """Install a tool with optimized retry mechanism."""
476
- if retry_count >= RETRY_LIMIT :
477
- logger .error (
478
- f"Installation of { tool_name } failed after { RETRY_LIMIT } attempts"
479
- )
480
- return False
481
-
469
+ def install_tool (self , tool_name : str ) -> bool :
470
+ """Install a tool."""
482
471
self .packages [tool_name ]["optional" ] = False
483
472
paths = self ._get_tool_paths (tool_name )
484
473
status = self ._check_tool_status (tool_name )
@@ -490,7 +479,7 @@ def install_tool(self, tool_name: str, retry_count: int = 0) -> bool:
490
479
# Case 2: Tool already installed, version check
491
480
if (status ['has_idf_tools' ] and status ['has_piopm' ] and
492
481
not status ['has_tools_json' ]):
493
- return self ._handle_existing_tool (tool_name , paths , retry_count )
482
+ return self ._handle_existing_tool (tool_name , paths )
494
483
495
484
logger .debug (f"Tool { tool_name } already configured" )
496
485
return True
@@ -518,9 +507,7 @@ def _install_with_idf_tools(self, tool_name: str, paths: Dict[str, str]) -> bool
518
507
logger .info (f"Tool { tool_name } successfully installed" )
519
508
return True
520
509
521
- def _handle_existing_tool (
522
- self , tool_name : str , paths : Dict [str , str ], retry_count : int
523
- ) -> bool :
510
+ def _handle_existing_tool (self , tool_name : str , paths : Dict [str , str ]) -> bool :
524
511
"""Handle already installed tools with version checking."""
525
512
if self ._check_tool_version (tool_name ):
526
513
# Version matches, use tool
@@ -535,7 +522,7 @@ def _handle_existing_tool(
535
522
# Remove the main tool directory (if it still exists after cleanup)
536
523
safe_remove_directory (paths ['tool_path' ])
537
524
538
- return self .install_tool (tool_name , retry_count + 1 )
525
+ return self .install_tool (tool_name )
539
526
540
527
def _configure_arduino_framework (self , frameworks : List [str ]) -> None :
541
528
"""Configure Arduino framework dependencies."""
0 commit comments