mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Make > operator exclude post and local releases (#2471)
## Summary This PR attempts to use a similar trick to that we added in https://github.com/astral-sh/uv/pull/1878, but for post-releases. In https://github.com/astral-sh/uv/pull/1878, we added a fake "minimum" version to enable us to treat `< 1.0.0` as _excluding_ pre-releases of 1.0.0. Today, on `main`, we accept post-releases and local versions in `> 1.0.0`. But per PEP 440, that should _exclude_ post-releases and local versions, unless the specifier is itself a pre-release, in which case, pre-releases are allowed (e.g., `> 1.0.0.post0` should allow `> 1.0.0.post1`). To support this, we add a fake "maximum" version that's greater than all the post and local releases for a given version. This leverages our last remaining free bit in the compact representation.
This commit is contained in:
parent
c296da34bf
commit
e69b76bc72
6 changed files with 222 additions and 110 deletions
|
@ -152,59 +152,6 @@ def main(scenarios: list[Path], snapshot_update: bool = True):
|
|||
expected[
|
||||
"explanation"
|
||||
] = "We do not have correct behavior for local version identifiers yet"
|
||||
elif scenario["name"] == "local-greater-than":
|
||||
expected["satisfiable"] = True
|
||||
expected["packages"] = [
|
||||
{
|
||||
"name": "local-greater-than-a",
|
||||
"version": "1.2.3+foo",
|
||||
"module_name": "local_greater_than_a",
|
||||
}
|
||||
]
|
||||
expected["explanation"] = (
|
||||
"We do not have correct behavior for local version identifiers yet"
|
||||
)
|
||||
elif scenario["name"] == "local-transitive-greater-than":
|
||||
expected["satisfiable"] = True
|
||||
expected["packages"] = [
|
||||
{
|
||||
"name": "local-transitive-greater-than-a",
|
||||
"version": "1.0.0",
|
||||
"module_name": "local_transitive_greater_than_a",
|
||||
},
|
||||
{
|
||||
"name": "local-transitive-greater-than-b",
|
||||
"version": "2.0.0+foo",
|
||||
"module_name": "local_transitive_greater_than_b",
|
||||
}
|
||||
]
|
||||
expected["explanation"] = (
|
||||
"We do not have correct behavior for local version identifiers yet"
|
||||
)
|
||||
elif scenario["name"] == 'post-greater-than':
|
||||
expected["satisfiable"] = True
|
||||
expected["packages"] = [
|
||||
{
|
||||
"name": "post-greater-than-a",
|
||||
"version": "1.2.3.post1",
|
||||
"module_name": "post_greater_than_a",
|
||||
}
|
||||
]
|
||||
expected["explanation"] = (
|
||||
"We do not have correct behavior for local version identifiers yet"
|
||||
)
|
||||
elif scenario["name"] == 'post-local-greater-than':
|
||||
expected["satisfiable"] = True
|
||||
expected["packages"] = [
|
||||
{
|
||||
"name": "post-local-greater-than-a",
|
||||
"version": "1.2.3.post1+local",
|
||||
"module_name": "post_local_greater_than_a",
|
||||
}
|
||||
]
|
||||
expected["explanation"] = (
|
||||
"We do not have correct behavior for local version identifiers yet"
|
||||
)
|
||||
|
||||
# Split scenarios into `install` and `compile` cases
|
||||
install_scenarios = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue