Archived
feat: Diff packages
This commit is contained in:
1 parent
bb123c23a1
commit
c264a5bea2
3 files changed
+44
-69
No files matched your search
@@ -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)
|
||||
Reference in new issue
Block a user