23 lines
633 B
Python
23 lines
633 B
Python
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)
|