Get all packages from lib/ directory. Args: lib_dir: Path to lib/ directory. Returns: List of package directory paths. Raises: SystemExit: If lib/ doesn't exist or no packages found.
(lib_dir: Path)
| 691 | |
| 692 | |
| 693 | def get_packages(lib_dir: Path) -> list[Path]: |
| 694 | """Get all packages from lib/ directory. |
| 695 | |
| 696 | Args: |
| 697 | lib_dir: Path to lib/ directory. |
| 698 | |
| 699 | Returns: |
| 700 | List of package directory paths. |
| 701 | |
| 702 | Raises: |
| 703 | SystemExit: If lib/ doesn't exist or no packages found. |
| 704 | """ |
| 705 | if not lib_dir.exists(): |
| 706 | console.print("[red]Error:[/red] lib/ directory not found") |
| 707 | sys.exit(1) |
| 708 | |
| 709 | packages = [p for p in lib_dir.iterdir() if p.is_dir()] |
| 710 | |
| 711 | if not packages: |
| 712 | console.print("[red]Error:[/red] No packages found in lib/") |
| 713 | sys.exit(1) |
| 714 | |
| 715 | return packages |
| 716 | |
| 717 | |
| 718 | PrereleaseIndicator = Literal["a", "b", "rc", "alpha", "beta", "dev"] |