Skip to content

Commit b332e56

Browse files
committed
MAINT: import pyproject_metadata unconditionally
pyprtoject_metadata is an hard dependency thus there is little value in trying to import it conditionally and simpler is better.
1 parent f97e099 commit b332e56

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

mesonpy/__init__.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
else:
4242
import tomllib
4343

44+
import pyproject_metadata
45+
4446
import mesonpy._compat
4547
import mesonpy._dylib
4648
import mesonpy._elf
@@ -55,8 +57,6 @@
5557
if typing.TYPE_CHECKING: # pragma: no cover
5658
from typing import Any, Callable, ClassVar, DefaultDict, List, Optional, Sequence, Set, TextIO, Tuple, Type, TypeVar, Union
5759

58-
import pyproject_metadata
59-
6060
from mesonpy._compat import Iterator, Literal, ParamSpec, Path
6161

6262
P = ParamSpec('P')
@@ -719,12 +719,7 @@ def __init__( # noqa: C901
719719
self._config = tomllib.loads(self._source_dir.joinpath('pyproject.toml').read_text())
720720
self._pep621 = 'project' in self._config
721721
if self.pep621:
722-
try:
723-
import pyproject_metadata
724-
except ModuleNotFoundError: # pragma: no cover
725-
self._metadata = None
726-
else:
727-
self._metadata = pyproject_metadata.StandardMetadata.from_pyproject(self._config, self._source_dir)
722+
self._metadata = pyproject_metadata.StandardMetadata.from_pyproject(self._config, self._source_dir)
728723
else:
729724
print(
730725
'{yellow}{bold}! Using Meson to generate the project metadata '

0 commit comments

Comments
 (0)