Skip to content

Commit f8c3e69

Browse files
committed
Handle upgrades of packages within ranges
The underlying functionality for this was already present within `pip-tool`s, however `pip-compile-multi` wasn't aware of it and thus made assumptions about the nature of the spec argument which turned out to be false. The fix here is to teach `pip-compile-multi` how to interpret these package specs to extract the names for the places it needs them while still passing the full spaces through to `pip-tools` for the actual upgrade. Fixes #392
1 parent eb0859a commit f8c3e69

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

pipcompilemulti/features/upgrade.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333
https://github.com/jazzband/pip-tools#updating-requirements
3434
"""
3535

36+
import re
37+
3638
from .base import BaseFeature, ClickOption
3739
from .forward import ForwardOption
3840

@@ -78,10 +80,19 @@ def reset(self):
7880
"""Clear cached packages."""
7981
self._env_packages_cache = {}
8082

83+
@property
84+
def package_specs(self):
85+
"""List of package specs to upgrade."""
86+
return self.value or []
87+
8188
@property
8289
def package_names(self):
8390
"""List of package names to upgrade."""
84-
return self.value or []
91+
def name_from_spec(name):
92+
match = re.match(r'(?P<package>[a-z0-9-_.]+)', name)
93+
assert match is not None
94+
return match.group(0)
95+
return [name_from_spec(x) for x in self.package_specs]
8596

8697
@property
8798
def active(self):
@@ -92,7 +103,7 @@ def pin_options(self):
92103
"""Pin command options for upgrading specific packages."""
93104
return [
94105
'--upgrade-package=' + package
95-
for package in self.package_names
106+
for package in self.package_specs
96107
]
97108

98109
def has_package(self, in_path, package_name):

0 commit comments

Comments
 (0)