From c66e0a9a1d6b2e8531aafb4c78f6e0c1ae4acc4e Mon Sep 17 00:00:00 2001 From: David Hotham Date: Wed, 24 Aug 2022 17:41:19 +0100 Subject: [PATCH] fix python_constraint_from_marker() again --- src/poetry/core/packages/utils/utils.py | 4 +++- tests/packages/utils/test_utils.py | 5 +++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/poetry/core/packages/utils/utils.py b/src/poetry/core/packages/utils/utils.py index c5d059946..b8c5f1400 100644 --- a/src/poetry/core/packages/utils/utils.py +++ b/src/poetry/core/packages/utils/utils.py @@ -303,7 +303,9 @@ def get_python_constraint_from_marker( return VersionRange() python_version_markers = markers["python_version"] + print(f"hello {python_version_markers=}") normalized = normalize_python_version_markers(python_version_markers) + print(f"hello {normalized=}") constraint = parse_constraint(normalized) return constraint @@ -316,7 +318,7 @@ def normalize_python_version_markers( # NOSONAR ands = [] for op, version in or_: # Expand python version - if op == "==" and "*" not in version: + if op == "==" and "*" not in version and version.count(".") < 2: version = "~" + version op = "" diff --git a/tests/packages/utils/test_utils.py b/tests/packages/utils/test_utils.py index 2afc8d3a4..f64550e0d 100644 --- a/tests/packages/utils/test_utils.py +++ b/tests/packages/utils/test_utils.py @@ -134,6 +134,11 @@ def test_convert_markers( 'python_version >= "3.5" and python_full_version != "3.7.6"', ">=3.5,<3.7.6 || >3.7.6", ), + # Full exact version + ( + 'python_full_version == "3.6.1"', + "3.6.1", + ), ], ) def test_get_python_constraint_from_marker(marker: str, constraint: str) -> None: