diff --git a/platform.py b/platform.py index 3f4c96642..e1fd7891b 100644 --- a/platform.py +++ b/platform.py @@ -43,12 +43,6 @@ from platformio.package.manager.tool import ToolPackageManager # Constants -try: - with open('/proc/device-tree/model') as f: - SUBPROCESS_TIMEOUT = 900 if 'raspberry pi' in f.read().lower() else 300 -except: - SUBPROCESS_TIMEOUT = 300 -RETRY_LIMIT = 3 DEFAULT_DEBUG_SPEED = "5000" DEFAULT_APP_OFFSET = "0x10000" tl_install_name = "tool-esp_install" @@ -402,7 +396,11 @@ def _check_tool_status(self, tool_name: str) -> Dict[str, bool]: } def _run_idf_tools_install(self, tools_json_path: str, idf_tools_path: str) -> bool: - """Execute idf_tools.py install command with timeout and error handling.""" + """ + Execute idf_tools.py install command. + Note: No timeout is set to allow installations to complete on slow networks. + The tool-esp_install handles the retry logic. + """ cmd = [ python_exe, idf_tools_path, @@ -414,11 +412,11 @@ def _run_idf_tools_install(self, tools_json_path: str, idf_tools_path: str) -> b ] try: + logger.info(f"Installing tools via idf_tools.py (this may take several minutes)...") result = subprocess.run( cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, - timeout=SUBPROCESS_TIMEOUT, check=False ) @@ -429,9 +427,6 @@ def _run_idf_tools_install(self, tools_json_path: str, idf_tools_path: str) -> b logger.debug("idf_tools.py executed successfully") return True - except subprocess.TimeoutExpired: - logger.error(f"Timeout in idf_tools.py after {SUBPROCESS_TIMEOUT}s") - return False except (subprocess.SubprocessError, OSError) as e: logger.error(f"Error in idf_tools.py: {e}") return False @@ -471,14 +466,8 @@ def _check_tool_version(self, tool_name: str) -> bool: logger.error(f"Error reading package data for {tool_name}: {e}") return False - def install_tool(self, tool_name: str, retry_count: int = 0) -> bool: - """Install a tool with optimized retry mechanism.""" - if retry_count >= RETRY_LIMIT: - logger.error( - f"Installation of {tool_name} failed after {RETRY_LIMIT} attempts" - ) - return False - + def install_tool(self, tool_name: str) -> bool: + """Install a tool.""" self.packages[tool_name]["optional"] = False paths = self._get_tool_paths(tool_name) status = self._check_tool_status(tool_name) @@ -490,7 +479,7 @@ def install_tool(self, tool_name: str, retry_count: int = 0) -> bool: # Case 2: Tool already installed, version check if (status['has_idf_tools'] and status['has_piopm'] and not status['has_tools_json']): - return self._handle_existing_tool(tool_name, paths, retry_count) + return self._handle_existing_tool(tool_name, paths) logger.debug(f"Tool {tool_name} already configured") return True @@ -518,9 +507,7 @@ def _install_with_idf_tools(self, tool_name: str, paths: Dict[str, str]) -> bool logger.info(f"Tool {tool_name} successfully installed") return True - def _handle_existing_tool( - self, tool_name: str, paths: Dict[str, str], retry_count: int - ) -> bool: + def _handle_existing_tool(self, tool_name: str, paths: Dict[str, str]) -> bool: """Handle already installed tools with version checking.""" if self._check_tool_version(tool_name): # Version matches, use tool @@ -535,7 +522,7 @@ def _handle_existing_tool( # Remove the main tool directory (if it still exists after cleanup) safe_remove_directory(paths['tool_path']) - return self.install_tool(tool_name, retry_count + 1) + return self.install_tool(tool_name) def _configure_arduino_framework(self, frameworks: List[str]) -> None: """Configure Arduino framework dependencies."""