lib.version.Dependency.__version_boundaries(): Use Version.next()
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m42s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m43s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m30s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m29s
CI / Packaging test (push) Successful in 0s
All checks were successful
CI / Packaging - Kali Linux (pull_request) Successful in 4m42s
CI / Packaging - OpenSUSE Tumbleweed (pull_request) Successful in 4m43s
CI / Packaging test (pull_request) Successful in 0s
CI / Packaging - Kali Linux (push) Successful in 4m30s
CI / Packaging - OpenSUSE Tumbleweed (push) Successful in 4m29s
CI / Packaging test (push) Successful in 0s
Use Version.next() in __version_boundaries, which steps the last existing part, so '= 1.0' spans '>= 1.0, < 1.1'. 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
83b5151f22
commit
3f00f4a416
2 changed files with 21 additions and 11 deletions
|
|
@ -74,13 +74,14 @@ class Dependency: # export
|
|||
return (specified, )
|
||||
ret: list[Boundary] = []
|
||||
match specified.op:
|
||||
case '>' | '>=':
|
||||
ret.append(specified)
|
||||
ret.append(Boundary('<', specified.version.next_binary_incompatible))
|
||||
case '=':
|
||||
try:
|
||||
next_version = specified.version.next
|
||||
except Version.Error:
|
||||
return (specified, )
|
||||
ret.append(Boundary('>=', specified.version))
|
||||
ret.append(Boundary('<', specified.version.next_binary_incompatible))
|
||||
case '<' | '<=':
|
||||
ret.append(Boundary('<', next_version))
|
||||
case '>' | '>=' | '<' | '<=':
|
||||
ret.append(specified)
|
||||
case _:
|
||||
self.__raise(
|
||||
|
|
@ -150,8 +151,9 @@ class Dependency: # export
|
|||
NAMES_ONLY renders the name alone. With untemplated = False the
|
||||
VERSION, VERSION-REVISION and REVISION macros are kept as
|
||||
written instead of resolved. include_revision = False drops the
|
||||
revision of VERSION specs. as_range expands a boundary that
|
||||
pins a full version into the range it spans. no_subpackages
|
||||
revision of VERSION specs. as_range expands a = boundary that
|
||||
does not pin a full version into the range it spans; other
|
||||
operators pass through unchanged. no_subpackages
|
||||
renders the base name, quote wraps the result in the given
|
||||
string.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ assert d.constraint_str() == 'foo = 1.2.3'
|
|||
assert d.constraint_str() == 'foo = 1.2.3'
|
||||
assert calls == ['foo']
|
||||
|
||||
# as_range expands a non-full boundary into the range it spans
|
||||
# as_range expands a non-full = boundary into the range it spans
|
||||
d = Dependency('foo = VERSION-REVISION', app.get_version)
|
||||
assert d.constraint_str(as_range = True) == 'foo = 1.2.3-45'
|
||||
d = Dependency('foo >= VERSION-REVISION', app.get_version)
|
||||
|
|
@ -123,14 +123,22 @@ assert constraint == 'foo = VERSION-REVISION'
|
|||
# A full version stays exact; a non-full one expands
|
||||
d = Dependency('foo = VERSION', app.get_version)
|
||||
assert d.constraint_str(as_range = True) == 'foo >= 1.2.3, foo < 1.2.4'
|
||||
# Operators other than = pass through unchanged
|
||||
d = Dependency('foo >= VERSION', app.get_version)
|
||||
assert d.constraint_str(as_range = True) == 'foo >= 1.2.3, foo < 1.2.4'
|
||||
# '<' and '<=' are not expanded
|
||||
assert d.constraint_str(as_range = True) == 'foo >= 1.2.3'
|
||||
d = Dependency('foo <= VERSION', app.get_version)
|
||||
assert d.constraint_str(as_range = True) == 'foo <= 1.2.3'
|
||||
# The bound steps a micro, so a tripartite core expands
|
||||
# The bound steps the last part, whatever it is
|
||||
d = Dependency('foo = 1.0', app.get_version)
|
||||
assert d.constraint_str(as_range = True) == 'foo >= 1.0, foo < 1.1'
|
||||
d = Dependency('foo = 1.2.3', app.get_version)
|
||||
assert d.constraint_str(as_range = True) == 'foo >= 1.2.3, foo < 1.2.4'
|
||||
d = Dependency('foo = 1.2.3rc1', app.get_version)
|
||||
assert d.constraint_str(as_range = True) == 'foo >= 1.2.3rc1, foo < 1.2.4'
|
||||
# A last part without leading digits cannot be stepped, so the pin
|
||||
# stays exact
|
||||
d = Dependency('foo = 1.0-rc1', app.get_version)
|
||||
assert d.constraint_str(as_range = True) == 'foo = 1.0-rc1'
|
||||
# Default syntax is SEM_VER
|
||||
d = Dependency('foo < 2.0')
|
||||
assert d.constraint_str(untemplated = False) == 'foo < 2.0'
|
||||
|
|
|
|||
Loading…
Reference in a new issue