Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/poetry/core/packages/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ def normalize_python_version_markers( # NOSONAR
version = "~" + version
op = ""

elif op == "!=" and "*" not in version:
elif op == "!=" and "*" not in version and version.count(".") < 2:
version += ".*"

elif op in ("<=", ">"):
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 @@ -129,6 +129,11 @@ def test_convert_markers(
('python_version >= "3.9" or sys_platform == "linux"', "*"),
# relevant python_version
('python_version >= "3.9" and sys_platform == "linux"', ">=3.9"),
# exclude specific version
(
'python_version >= "3.5" and python_full_version != "3.7.6"',
">=3.5,<3.7.6 || >3.7.6",
),
],
)
def test_get_python_constraint_from_marker(marker: str, constraint: str) -> None:
Expand Down