Skip to content

Commit

Permalink
fix python_constraint_from_marker() again
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby committed Aug 24, 2022
1 parent c9348e8 commit c66e0a9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/poetry/core/packages/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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 = ""

Expand Down
5 changes: 5 additions & 0 deletions tests/packages/utils/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c66e0a9

Please sign in to comment.