Compute prioritized list of modules to update. Scoring: - Modules with no pylib dependencies: score = -1 - Modules with pylib dependencies: score = count of NOT up-to-date deps Sorting (ascending by score): 1. More reverse dependencies (modules depending on this) =
(
cpython_prefix: str,
lib_prefix: str,
include_done: bool = False,
)
| 24 | |
| 25 | |
| 26 | def compute_todo_list( |
| 27 | cpython_prefix: str, |
| 28 | lib_prefix: str, |
| 29 | include_done: bool = False, |
| 30 | ) -> list[dict]: |
| 31 | """Compute prioritized list of modules to update. |
| 32 | |
| 33 | Scoring: |
| 34 | - Modules with no pylib dependencies: score = -1 |
| 35 | - Modules with pylib dependencies: score = count of NOT up-to-date deps |
| 36 | |
| 37 | Sorting (ascending by score): |
| 38 | 1. More reverse dependencies (modules depending on this) = higher priority |
| 39 | 2. Fewer native dependencies = higher priority |
| 40 | |
| 41 | Returns: |
| 42 | List of dicts with module info, sorted by priority |
| 43 | """ |
| 44 | from update_lib.cmd_deps import get_all_modules |
| 45 | from update_lib.deps import ( |
| 46 | get_all_hard_deps, |
| 47 | get_rust_deps, |
| 48 | get_soft_deps, |
| 49 | is_up_to_date, |
| 50 | ) |
| 51 | |
| 52 | all_modules = get_all_modules(cpython_prefix) |
| 53 | |
| 54 | # Build dependency data for all modules |
| 55 | module_data = {} |
| 56 | for name in all_modules: |
| 57 | soft_deps = get_soft_deps(name, cpython_prefix) |
| 58 | native_deps = get_rust_deps(name, cpython_prefix) |
| 59 | up_to_date = is_up_to_date(name, cpython_prefix, lib_prefix) |
| 60 | |
| 61 | # Get hard_deps and check their status |
| 62 | hard_deps = get_all_hard_deps(name, cpython_prefix) |
| 63 | hard_deps_status = { |
| 64 | hd: is_up_to_date(hd, cpython_prefix, lib_prefix) for hd in hard_deps |
| 65 | } |
| 66 | |
| 67 | module_data[name] = { |
| 68 | "name": name, |
| 69 | "soft_deps": soft_deps, |
| 70 | "native_deps": native_deps, |
| 71 | "up_to_date": up_to_date, |
| 72 | "hard_deps_status": hard_deps_status, |
| 73 | } |
| 74 | |
| 75 | # Build reverse dependency map: who depends on this module |
| 76 | reverse_deps: dict[str, set[str]] = {name: set() for name in all_modules} |
| 77 | for name, data in module_data.items(): |
| 78 | for dep in data["soft_deps"]: |
| 79 | if dep in reverse_deps: |
| 80 | reverse_deps[dep].add(name) |
| 81 | |
| 82 | # Compute scores and filter |
| 83 | result = [] |
no test coverage detected