Allow prerelease versions in marker evaluation

- i.e. make 3.7.0 < 3.13.0rc3 in python_full_version marker
This commit is contained in:
Miro Hrončok 2024-10-04 12:09:47 +02:00
commit 302069467c
2 changed files with 30 additions and 0 deletions

24
c5f1db976c.patch Normal file
View file

@ -0,0 +1,24 @@
From c5f1db976c89074e5f18f15b04cfa21132161a73 Mon Sep 17 00:00:00 2001
From: Thomas Grainger <tagrain@gmail.com>
Date: Wed, 16 Mar 2022 20:10:30 +0000
Subject: [PATCH] allow prerelease versions in marker evaluation (#523)
Fixes #522
---
packaging/markers.py | 2 +-
tests/test_markers.py | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/pip/_vendor/packaging/markers.py b/src/pip/_vendor/packaging/markers.py
index 56d4b240..39905148 100644
--- a/src/pip/_vendor/packaging/markers.py
+++ b/src/pip/_vendor/packaging/markers.py
@@ -192,7 +192,7 @@ def _eval_op(lhs: str, op: Op, rhs: str) -> bool:
except InvalidSpecifier:
pass
else:
- return spec.contains(lhs)
+ return spec.contains(lhs, prereleases=True)
oper: Optional[Operator] = _operators.get(op.serialize())
if oper is None:

View file

@ -82,6 +82,12 @@ Patch: nowarn-pip._internal.main.patch
# Upstream issue: https://github.com/pypa/packaging/issues/368
Patch: no-version-warning.patch
# Allow prerelease versions in marker evaluation (from packaging 22+)
# i.e. make 3.7.0 < 3.13.0rc3 in python_full_version marker
# https://github.com/pypa/packaging/commit/c5f1db976c
# Manually edited to apply to src/pip/_vendor/packaging
Patch: c5f1db976c.patch
%description
pip is a package management system used to install and manage software packages
written in Python. Many packages can be found in the Python Package Index