Skip to content

Commit bb0071a

Browse files
authored
fix created_nested_marker for python wildcard constraints (#853)
1 parent 4ae193b commit bb0071a

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/poetry/core/packages/utils/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def create_nested_marker(
274274
padding = ".0" * (3 - version.precision)
275275
part = f'python_full_version > "{version}{padding}"'
276276
else:
277-
part = f'{min_name} {op} "{version}"'
277+
part = f'{min_name} {op} "{version.stable}"'
278278

279279
parts.append(part)
280280

@@ -292,7 +292,7 @@ def create_nested_marker(
292292
padding = ".0" * (3 - version.precision)
293293
part = f'python_full_version <= "{version}{padding}"'
294294
else:
295-
part = f'{max_name} {op} "{version}"'
295+
part = f'{max_name} {op} "{version.stable}"'
296296

297297
parts.append(part)
298298

tests/packages/utils/test_utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,12 @@ def test_create_nested_marker_base_constraint(constraint: str, expected: str) ->
150150
' or (python_version >= "3.9" and python_full_version <= "3.10.0")'
151151
),
152152
),
153+
# wildcard
154+
("3.*", 'python_version >= "3" and python_version < "4"'),
155+
("3.9.*", 'python_version >= "3.9" and python_version < "3.10"'),
156+
("3.*,>=3.9", 'python_version >= "3.9" and python_version < "4"'),
157+
("3.*,>=3.9.0", 'python_full_version >= "3.9.0" and python_version < "4"'),
158+
("3.*,>=3.9.1", 'python_full_version >= "3.9.1" and python_version < "4"'),
153159
],
154160
)
155161
def test_create_nested_marker_version_constraint(

0 commit comments

Comments
 (0)