feat(commit): individual packages from config respected
This commit is contained in:
+18
-6
@@ -12,11 +12,23 @@ def pkg_diff(target: List[str], actual: List[str]) -> tuple[List[str], List[str]
|
||||
A tuple with first the missing (not installed) packages
|
||||
and second the extraneous (to be uninstalled) packages
|
||||
"""
|
||||
for i, pkg in enumerate(actual):
|
||||
removed = []
|
||||
diffed_out = []
|
||||
for pkg in actual:
|
||||
try:
|
||||
idx = target.index(pkg)
|
||||
target.pop(idx)
|
||||
actual.pop(i)
|
||||
diffed_out.append(target.index(pkg))
|
||||
except Exception:
|
||||
pass
|
||||
return (target, actual)
|
||||
removed.append(pkg)
|
||||
|
||||
diffed_out.reverse()
|
||||
new_pkgs = []
|
||||
if len(diffed_out) > 0:
|
||||
curr = diffed_out.pop()
|
||||
for i, pkg in enumerate(target):
|
||||
if i != curr:
|
||||
new_pkgs.append(pkg)
|
||||
else:
|
||||
if len(diffed_out) > 0:
|
||||
curr = diffed_out.pop()
|
||||
|
||||
return (new_pkgs, removed)
|
||||
|
||||
Reference in New Issue
Block a user