feat: Diff packages

This commit is contained in:
2026-04-16 16:02:15 +02:00
parent bb123c23a1
commit c264a5bea2
3 changed files with 44 additions and 69 deletions
+22
View File
@@ -0,0 +1,22 @@
from typing import List
def pkg_diff(target: List[str], actual: List[str]) -> tuple[List[str], List[str]]:
"""Compute a diff between target packages and installed packages
Args:
target: The target packages
actual: The actually installed packages
Returns:
A tuple with first the missing (not installed) packages
and second the extraneous (to be uninstalled) packages
"""
for i, pkg in enumerate(actual):
try:
idx = target.index(pkg)
target.pop(idx)
actual.pop(i)
except Exception:
pass
return (target, actual)