lib.version.Dependency.__version_boundaries(): Expand non-full specs
Full version dependency specs ("= 1.2.3-4" or "= VERSION-REVISION") don't
need expansion, they pin the wanted version with an = fine exactly.
__version_boundary has that the wrong way around, fix that.
Also fix the is_full and version_boundaries() docstrings, which still
describe the old behavior.
Tests written by AI.
Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v0.85.1
Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
f689e4ba94
commit
a5885283d0
3 changed files with 15 additions and 20 deletions
|
|
@ -70,7 +70,7 @@ class Dependency: # export
|
|||
specified = self.__parsed_spec[1]
|
||||
if specified is None:
|
||||
return []
|
||||
if not expanded or not specified.version.is_full:
|
||||
if not expanded or specified.version.is_full:
|
||||
return (specified, )
|
||||
ret: list[Boundary] = []
|
||||
match specified.op:
|
||||
|
|
@ -132,7 +132,7 @@ class Dependency: # export
|
|||
|
||||
def version_boundaries(self, expanded: bool = False) -> Sequence[Boundary]:
|
||||
"""The parsed version boundary, or the range it spans when
|
||||
expanded is True and it pins a full version.
|
||||
expanded is True and it does not pin a full version.
|
||||
"""
|
||||
return self.__version_boundaries(expanded)
|
||||
|
||||
|
|
|
|||
|
|
@ -141,9 +141,8 @@ class Version: # export
|
|||
def is_full(self) -> bool:
|
||||
"""True if the spec pins a complete version: the
|
||||
VERSION-REVISION macro, or a literal of the form
|
||||
MAJOR.MINOR.MICRO-REVISION. Only full versions have the
|
||||
exclusive upper bound (next_binary_incompatible) that range
|
||||
expansion relies on.
|
||||
MAJOR.MINOR.MICRO-REVISION. Range expansion leaves full
|
||||
versions exact and expands the non-full specs.
|
||||
"""
|
||||
if self.__spec == 'VERSION-REVISION':
|
||||
return True
|
||||
|
|
|
|||
Loading…
Reference in a new issue