Skip to content

Commit

Permalink
MAINT: bump required pyproject-metadata version to 0.9.0
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dnicolodi committed Oct 28, 2024
1 parent 1593349 commit 752a44e
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 22 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"',
]

Expand Down Expand Up @@ -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"',
]

Expand Down
3 changes: 0 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,13 @@

import packaging.metadata
import packaging.version
import pyproject_metadata
import pytest

import mesonpy

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]))

Expand Down
5 changes: 1 addition & 4 deletions tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
8 changes: 1 addition & 7 deletions tests/test_sdist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions tests/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 752a44e

Please sign in to comment.