summaryrefslogtreecommitdiff
path: root/src/tox/provision.py
diff options
context:
space:
mode:
authorSorin Sbarnea <ssbarnea@redhat.com>2022-11-27 04:32:04 +0000
committerGitHub <noreply@github.com>2022-11-26 20:32:04 -0800
commit70601f951de92420f56fff323ec2a9a5c37b163a (patch)
treec99c476c57a7ae2debb4ee90821ee79e68b98e8d /src/tox/provision.py
parentd4b56e7d74e78f8fb67a206c426b59313d74dd5e (diff)
downloadtox-git-70601f951de92420f56fff323ec2a9a5c37b163a.tar.gz
Avoid impossible minversion requirement (#2549)
Co-authored-by: Bernát Gábor <bgabor8@bloomberg.net> Fixes https://github.com/tox-dev/tox/issues/2414
Diffstat (limited to 'src/tox/provision.py')
-rw-r--r--src/tox/provision.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/tox/provision.py b/src/tox/provision.py
index 95273fe4..46ca2663 100644
--- a/src/tox/provision.py
+++ b/src/tox/provision.py
@@ -75,6 +75,11 @@ def provision(state: State) -> int | bool:
def add_tox_requires_min_version(requires: list[Requirement]) -> list[Requirement]:
min_version: Version = state.conf.core["min_version"]
+ # If own version can be a development one or a pre-release, we need to only use its base_version for
+ # requirements, or pip will never be able to find a version that is compatible with the requirement.
+ if min_version.is_devrelease or min_version.is_prerelease:
+ # Earliest possible pre-release number for current base version.
+ min_version = Version(f"{min_version.base_version}a0")
requires.append(Requirement(f"tox >= {min_version.public}"))
return requires