Skip to content

Commit d70d341

Browse files
authored
Merge branch 'main' into fix-prerelease-detection-for->-and-<
2 parents e099c94 + 793ee28 commit d70d341

File tree

9 files changed

+37
-13
lines changed

9 files changed

+37
-13
lines changed

.github/workflows/codeql.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ jobs:
3131

3232
steps:
3333
- name: Checkout repository
34-
uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
34+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
3535

3636
# Initializes the CodeQL tools for scanning.
3737
- name: Initialize CodeQL
38-
uses: github/codeql-action/init@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
38+
uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
3939
with:
4040
languages: ${{ matrix.language }}
4141
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -47,9 +47,9 @@ jobs:
4747

4848
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
4949
- name: Autobuild
50-
uses: github/codeql-action/autobuild@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
50+
uses: github/codeql-action/autobuild@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
5151

5252
- name: Perform CodeQL Analysis
53-
uses: github/codeql-action/analyze@1b1aada464948af03b950897e5eb522f92603cc2 # v3.24.9
53+
uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
5454
with:
5555
category: "/language:${{matrix.language}}"

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
runs-on: ubuntu-latest
2424

2525
steps:
26-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
26+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
2727

2828
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
2929
name: Install Python

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
runs-on: ubuntu-latest
2626

2727
steps:
28-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
28+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
2929

3030
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
3131
name: Install Python
@@ -46,13 +46,13 @@ jobs:
4646
needs: lint
4747

4848
steps:
49-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
49+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
5050

5151
- name: Build
5252
run: pipx run build
5353

5454
- name: Archive files
55-
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
55+
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
5656
with:
5757
name: dist
5858
path: dist

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "pypy3.8", "pypy3.9", "pypy3.10"]
3030

3131
steps:
32-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
32+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
3333

3434
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
3535
name: Install Python ${{ matrix.python_version }}

CHANGELOG.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ Changelog
66

77
No unreleased changes.
88

9+
24.1 - 2024-06-10
10+
~~~~~~~~~~~~~~~~~
11+
12+
No unreleased changes.
13+
914
24.0 - 2024-03-10
1015
~~~~~~~~~~~~~~~~~
1116

docs/development/submitting-patches.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ follow the directions on the :doc:`security page </security>`.
1818
Code
1919
----
2020

21-
This project's source is auto-formatted with |black|. You can check if your
21+
This project's source is auto-formatted with |ruff|. You can check if your
2222
code meets our requirements by running our linters against it with ``nox -s
2323
lint`` or ``pre-commit run --all-files``.
2424

@@ -67,8 +67,8 @@ So, specifically:
6767
* Use Sphinx parameter/attribute documentation `syntax`_.
6868

6969

70-
.. |black| replace:: ``black``
71-
.. _black: https://pypi.org/project/black/
70+
.. |ruff| replace:: ``ruff``
71+
.. _ruff: https://astral.sh/ruff
7272
.. _`Write comments as complete sentences.`: https://nedbatchelder.com/blog/201401/comments_should_be_sentences.html
7373
.. _`syntax`: https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html
7474
.. _`Studies have shown`: https://www.microsoft.com/en-us/research/publication/characteristics-of-useful-code-reviews-an-empirical-study-at-microsoft/

src/packaging/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
__summary__ = "Core utilities for Python packages"
77
__uri__ = "https://github.com/pypa/packaging"
88

9-
__version__ = "24.1.dev0"
9+
__version__ = "24.2.dev0"
1010

1111
__author__ = "Donald Stufft and individual contributors"
1212
__email__ = "[email protected]"

src/packaging/markers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,12 @@ def evaluate(self, environment: dict[str, str] | None = None) -> bool:
309309
"""
310310
current_environment = cast("dict[str, str]", default_environment())
311311
current_environment["extra"] = ""
312+
# Work around platform.python_version() returning something that is not PEP 440
313+
# compliant for non-tagged Python builds. We preserve default_environment()'s
314+
# behavior of returning platform.python_version() verbatim, and leave it to the
315+
# caller to provide a syntactically valid version if they want to override it.
316+
if current_environment["python_full_version"].endswith("+"):
317+
current_environment["python_full_version"] += "local"
312318
if environment is not None:
313319
current_environment.update(environment)
314320
# The API used to allow setting extra to None. We need to handle this

tests/test_markers.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import platform
99
import sys
1010
from typing import cast
11+
from unittest import mock
1112

1213
import pytest
1314

@@ -19,6 +20,7 @@
1920
default_environment,
2021
format_full_version,
2122
)
23+
from packaging.version import InvalidVersion
2224

2325
VARIABLES = [
2426
"extra",
@@ -384,3 +386,14 @@ def test_extra_str_normalization(self):
384386

385387
assert str(Marker(lhs)) == f'"{normalized_name}" == extra'
386388
assert str(Marker(rhs)) == f'extra == "{normalized_name}"'
389+
390+
def test_python_full_version_untagged_user_provided(self):
391+
"""A user-provided python_full_version ending with a + fails to parse."""
392+
with pytest.raises(InvalidVersion):
393+
Marker("python_full_version < '3.12'").evaluate(
394+
{"python_full_version": "3.11.1+"}
395+
)
396+
397+
def test_python_full_version_untagged(self):
398+
with mock.patch("platform.python_version", return_value="3.11.1+"):
399+
assert Marker("python_full_version < '3.12'").evaluate()

0 commit comments

Comments
 (0)