Skip to content

Commit bda04fb

Browse files
committed
Handle versioned packages on removal as well as addition.
1 parent a413f9a commit bda04fb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

pyinfra/operations/util/packaging.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,14 @@ def ensure_packages(
138138
)
139139

140140
for package in diff_packages: # add/remove from current packages
141+
version = 'unknown'
142+
if version_join:
143+
bits = package.rsplit(version_join, 1)
144+
package = bits[0]
145+
if len(bits) == 2:
146+
version = bits[1]
147+
141148
if present:
142-
version = 'unknown'
143-
if version_join:
144-
bits = package.rsplit(version_join, 1)
145-
package = bits[0]
146-
if len(bits) == 2:
147-
version = bits[1]
148149
current_packages[package] = [version]
149150
else:
150151
current_packages.pop(package, None)

0 commit comments

Comments
 (0)