(context: Context)
| 256 | |
| 257 | |
| 258 | def get_packages(context: Context) -> dict[str, PackageInfo]: |
| 259 | packages: list[PackageInfo] = [] |
| 260 | |
| 261 | for maybe_pkg in PY_DIR.glob("*"): |
| 262 | if (maybe_pkg / "pyproject.toml").exists(): |
| 263 | packages.append(make_py_pkg_info(context, maybe_pkg)) |
| 264 | else: |
| 265 | msg = f"unexpected dir or file: {maybe_pkg}" |
| 266 | raise Exit(msg) |
| 267 | |
| 268 | packages_dir = JS_DIR / "packages" |
| 269 | for maybe_pkg in packages_dir.glob("*"): |
| 270 | if (maybe_pkg / "package.json").exists(): |
| 271 | packages.append(make_js_pkg_info(maybe_pkg)) |
| 272 | elif maybe_pkg.is_dir(): |
| 273 | for maybe_ns_pkg in maybe_pkg.glob("*"): |
| 274 | if (maybe_ns_pkg / "package.json").exists(): |
| 275 | packages.append(make_js_pkg_info(maybe_ns_pkg)) |
| 276 | else: |
| 277 | msg = f"unexpected dir or file: {maybe_pkg}" |
| 278 | raise Exit(msg) |
| 279 | |
| 280 | packages_by_name = {p.name: p for p in packages} |
| 281 | if len(packages_by_name) != len(packages): |
| 282 | raise Exit("duplicate package names detected") |
| 283 | |
| 284 | return packages_by_name |
| 285 | |
| 286 | |
| 287 | def make_py_pkg_info(context: Context, pkg_dir: Path) -> PackageInfo: |
no test coverage detected