Process a single library update and return result.
(lib: dict, libraries_path: Path, progress, verbose: bool)
| 237 | |
| 238 | |
| 239 | def _process_library_update(lib: dict, libraries_path: Path, progress, verbose: bool) -> tuple[str, str, bool]: |
| 240 | """Process a single library update and return result.""" |
| 241 | name = lib.get("name") |
| 242 | lib_type = lib.get("type", "git") |
| 243 | enabled = lib.get("enabled", True) |
| 244 | |
| 245 | if not enabled: |
| 246 | if verbose: |
| 247 | display.text(f"Skipping disabled library: {name}", style="dim") |
| 248 | return (name, "Skipped (disabled)", False) |
| 249 | |
| 250 | if lib_type == "static": |
| 251 | if verbose: |
| 252 | display.text(f"Skipping static library: {name} (no sync needed)", style="dim") |
| 253 | return (name, "N/A (static)", True) |
| 254 | |
| 255 | # Handle git libraries |
| 256 | url = lib.get("url") |
| 257 | branch = lib.get("branch") |
| 258 | directory = lib.get("directory", "library") |
| 259 | |
| 260 | task = progress.add_task(f"Updating {name}...", total=None) |
| 261 | target_path = libraries_path / name |
| 262 | success, message = _clone_or_pull_repo(name, url, target_path, branch, directory) |
| 263 | progress.remove_task(task) |
| 264 | |
| 265 | if verbose: |
| 266 | if success: |
| 267 | display.success(f"{name}: {message}") |
| 268 | else: |
| 269 | display.error(f"{name}: {message}") |
| 270 | |
| 271 | return (name, message, success) |
| 272 | |
| 273 | |
| 274 | def _display_update_summary(results: list[tuple[str, str, bool]]) -> None: |
no test coverage detected