From 752a44ea130136dcb607adef39a3783c7586f9ca Mon Sep 17 00:00:00 2001 From: Daniele Nicolodi Date: Mon, 28 Oct 2024 21:39:54 +0100 Subject: [PATCH] MAINT: bump required pyproject-metadata version to 0.9.0 Having PEP 639 metadata supported or not based on the version of a transitive dependency would not make for a great user experience. Supporting PEP 639 metadata requires pyproject-metadata 0.9.0. --- .github/workflows/tests.yml | 4 ---- pyproject.toml | 4 ++-- tests/conftest.py | 3 --- tests/test_project.py | 5 +---- tests/test_sdist.py | 8 +------- tests/test_wheel.py | 3 +-- 6 files changed, 5 insertions(+), 22 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 42201ae96..c4c08ec2a 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -101,10 +101,6 @@ jobs: - os: windows-latest python: '3.12' meson: '@git+https://github.com/mesonbuild/meson.git' - # Test with oldest supported pyproject-metadata - - os: ubuntu-latest - python: '3.12' - pyproject_metadata: '==0.8.0' steps: - name: Checkout diff --git a/pyproject.toml b/pyproject.toml index 6121d8888..f08d3f950 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ requires = [ 'meson >= 0.63.3; python_version < "3.12"', 'meson >= 1.2.3; python_version >= "3.12"', 'packaging >= 19.0', - 'pyproject-metadata >= 0.8.0', + 'pyproject-metadata >= 0.9.0', 'tomli >= 1.0.0; python_version < "3.11"', ] @@ -37,7 +37,7 @@ dependencies = [ 'meson >= 0.63.3; python_version < "3.12"', 'meson >= 1.2.3; python_version >= "3.12"', 'packaging >= 19.0', - 'pyproject-metadata >= 0.8.0', + 'pyproject-metadata >= 0.9.0', 'tomli >= 1.0.0; python_version < "3.11"', ] diff --git a/tests/conftest.py b/tests/conftest.py index 369f9a31e..5765eb12e 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -18,7 +18,6 @@ import packaging.metadata import packaging.version -import pyproject_metadata import pytest import mesonpy @@ -26,8 +25,6 @@ from mesonpy._util import chdir -PYPROJECT_METADATA_VERSION = tuple(map(int, pyproject_metadata.__version__.split('.')[:2])) - _meson_ver_str = subprocess.run(['meson', '--version'], check=True, stdout=subprocess.PIPE, text=True).stdout MESON_VERSION = tuple(map(int, _meson_ver_str.split('.')[:3])) diff --git a/tests/test_project.py b/tests/test_project.py index 15bb76d44..2bdf7a75f 100644 --- a/tests/test_project.py +++ b/tests/test_project.py @@ -19,7 +19,7 @@ import mesonpy -from .conftest import MESON_VERSION, PYPROJECT_METADATA_VERSION, in_git_repo_context, metadata, package_dir +from .conftest import MESON_VERSION, in_git_repo_context, metadata, package_dir def test_unsupported_python_version(package_unsupported_python_version): @@ -40,7 +40,6 @@ def test_missing_dynamic_version(package_missing_dynamic_version): pass -@pytest.mark.skipif(PYPROJECT_METADATA_VERSION < (0, 9), reason='pyproject-metadata too old') @pytest.mark.skipif(MESON_VERSION < (1, 6, 0), reason='meson too old') @pytest.mark.filterwarnings('ignore:canonicalization and validation of license expression') def test_meson_build_metadata(tmp_path): @@ -67,7 +66,6 @@ def test_meson_build_metadata(tmp_path): ''')) -@pytest.mark.skipif(PYPROJECT_METADATA_VERSION < (0, 9), reason='pyproject-metadata too old') @pytest.mark.skipif(MESON_VERSION < (1, 6, 0), reason='meson too old') @pytest.mark.filterwarnings('ignore:canonicalization and validation of license expression') def test_dynamic_license(tmp_path): @@ -96,7 +94,6 @@ def test_dynamic_license(tmp_path): ''')) -@pytest.mark.skipif(PYPROJECT_METADATA_VERSION < (0, 9), reason='pyproject-metadata too old') @pytest.mark.skipif(MESON_VERSION < (1, 6, 0), reason='meson too old') @pytest.mark.filterwarnings('ignore:canonicalization and validation of license expression') def test_dynamic_license_files(tmp_path): diff --git a/tests/test_sdist.py b/tests/test_sdist.py index a155059fd..a98b27d10 100644 --- a/tests/test_sdist.py +++ b/tests/test_sdist.py @@ -32,15 +32,9 @@ def test_pep621_metadata(sdist_full_metadata): sdist_pkg_info = sdist.extractfile('full_metadata-1.2.3/PKG-INFO').read() meta = metadata(sdist_pkg_info) - - # pyproject-metadata prior to 0.9.0 strips trailing newlines + # Including the trailing newline in the expected value is inconvenient. meta['license'] = meta['license'].rstrip() - # pyproject-metadata 0.9.0 and later does not emit Home-Page - meta.pop('home_page', None) - # nor normalizes Project-URL keys - meta['project_urls'] = {k.lower(): v for k, v in meta['project_urls'].items()} - assert meta == metadata(textwrap.dedent('''\ Metadata-Version: 2.1 Name: full-metadata diff --git a/tests/test_wheel.py b/tests/test_wheel.py index ceb04843f..5241ee81c 100644 --- a/tests/test_wheel.py +++ b/tests/test_wheel.py @@ -16,7 +16,7 @@ import mesonpy -from .conftest import MESON_VERSION, PYPROJECT_METADATA_VERSION, adjust_packaging_platform_tag, metadata +from .conftest import MESON_VERSION, adjust_packaging_platform_tag, metadata EXT_SUFFIX = sysconfig.get_config_var('EXT_SUFFIX') @@ -136,7 +136,6 @@ def test_contents_license_file(wheel_license_file): assert artifact.read('license_file-1.0.0.dist-info/LICENSE.custom').rstrip() == b'Hello!' -@pytest.mark.xfail(PYPROJECT_METADATA_VERSION < (0, 9), reason='pyproject-metadata too old') @pytest.mark.filterwarnings('ignore:canonicalization and validation of license expression') def test_license_pep639(wheel_license_pep639): artifact = wheel.wheelfile.WheelFile(wheel_license_pep639)