Skip to content

Commit

Permalink
fix python_constraint_from_marker()
Browse files Browse the repository at this point in the history
  • Loading branch information
dimbleby committed Aug 2, 2022
1 parent 7efc33e commit 2bd05a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
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

0 comments on commit 2bd05a3

Please sign in to comment.