Skip to content

Commit

Permalink
mesonpy: make pep621 a hard dependency
Browse files Browse the repository at this point in the history
Signed-off-by: Filipe Laíns <lains@riseup.net>
  • Loading branch information
FFY00 committed May 24, 2022
1 parent 73e3aee commit 86313a4
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 27 deletions.
13 changes: 0 additions & 13 deletions mesonpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
class _depstr:
ninja = 'ninja >= 1.10.0'
patchelf_wrapper = 'patchelf-wrapper'
pep621 = 'pep621 >= 0.3.0'
wheel = 'wheel >= 0.36.0' # noqa: F811


Expand Down Expand Up @@ -762,16 +761,6 @@ def _project(config_settings: Optional[Dict[Any, Any]]) -> Iterator[Project]:
yield project


def get_requires_for_build_sdist(
config_settings: Optional[Dict[Any, Any]] = None,
) -> List[str]:
dependencies = []
with _project(config_settings) as project:
if project.pep621:
dependencies.append(_depstr.pep621)
return dependencies


def build_sdist(
sdist_directory: str,
config_settings: Optional[Dict[Any, Any]] = None,
Expand All @@ -790,8 +779,6 @@ def get_requires_for_build_wheel(
with _project(config_settings) as project:
if not project.is_pure and platform.system() == 'Linux':
dependencies.append(_depstr.patchelf_wrapper)
if project.pep621:
dependencies.append(_depstr.pep621)
return dependencies


Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ backend-path = ['.']
requires = [
'meson>=0.60.0',
'ninja',
'pep621>=0.3.0',
'tomli>=1.0.0',
'typing-extensions>=3.7.4; python_version<"3.8"',
]
Expand All @@ -28,6 +29,7 @@ dependencies = [
'colorama; os_name == "nt"',
'meson>=0.60.0',
'ninja',
'pep621>=0.3.0', # not a hard dependency, only needed for projects that use PEP 621 metadata
'tomli>=1.0.0',
'typing-extensions>=3.7.4; python_version<"3.8"',
]
Expand Down
14 changes: 0 additions & 14 deletions tests/test_pep517.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,11 @@
VENDORING_DEPS = set()


@pytest.mark.parametrize(
('package', 'expected'),
[
('pure', set()), # no PEP 621
('full-metadata', {mesonpy._depstr.pep621}), # PEP 621
]
)
def test_get_requires_for_build_sdist(package, expected):
with cd_package(package):
assert set(mesonpy.get_requires_for_build_sdist()) == expected


@pytest.mark.parametrize(
('package', 'expected'),
[
('pure', set()), # pure and no PEP 621
('full-metadata', {mesonpy._depstr.pep621}), # pure and PEP 621
('library', VENDORING_DEPS), # not pure and not PEP 621
('library-pep621', {mesonpy._depstr.pep621, *VENDORING_DEPS}), # not pure and PEP 621
]
)
def test_get_requires_for_build_wheel(package, expected):
Expand Down

0 comments on commit 86313a4

Please sign in to comment.