From 77dfb37334b290cf8a4a1c5d56cc5a6ba9320cb9 Mon Sep 17 00:00:00 2001 From: Frost Ming Date: Mon, 22 Jul 2024 08:37:20 +0800 Subject: [PATCH] fix: add python_version to markers if requires_python is `==` Signed-off-by: Frost Ming --- src/dep_logic/tags/tags.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/dep_logic/tags/tags.py b/src/dep_logic/tags/tags.py index d99e473..51fb83d 100644 --- a/src/dep_logic/tags/tags.py +++ b/src/dep_logic/tags/tags.py @@ -6,6 +6,8 @@ from platform import python_implementation from typing import TYPE_CHECKING +from dep_logic.specifiers.range import RangeSpecifier + from ..specifiers import InvalidSpecifier, VersionSpecifier, parse_version_specifier from .platform import Platform @@ -235,6 +237,15 @@ def wheel_compatibility( def markers(self) -> dict[str, str]: result = {} + if ( + isinstance(self.requires_python, RangeSpecifier) + and (version := self.requires_python.min) is not None + and version == self.requires_python.max + ): + result.update( + python_version=f"{version.major}.{version.minor}", + python_full_version=str(version), + ) if self.platform is not None: result.update(self.platform.markers()) if self.implementation is not None: