diff options
| author | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-03-30 19:41:38 +0100 |
|---|---|---|
| committer | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2022-03-30 19:41:38 +0100 |
| commit | 0a5e992ea63b123982df60fdaec5bd2dce5e3248 (patch) | |
| tree | f87e8706f2ff5aad33e00423c8f2d682d227eb3e /setuptools/config/pyprojecttoml.py | |
| parent | cc55da0c4afbd128cf58d1cd4862e30bfceba56d (diff) | |
| download | python-setuptools-git-0a5e992ea63b123982df60fdaec5bd2dce5e3248.tar.gz | |
Move _validate_pyproject to config
Diffstat (limited to 'setuptools/config/pyprojecttoml.py')
| -rw-r--r-- | setuptools/config/pyprojecttoml.py | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/setuptools/config/pyprojecttoml.py b/setuptools/config/pyprojecttoml.py index e20d71d2..9666ca18 100644 --- a/setuptools/config/pyprojecttoml.py +++ b/setuptools/config/pyprojecttoml.py @@ -26,18 +26,12 @@ def load_file(filepath: _Path) -> dict: return tomli.load(file) -def validate(config: dict, filepath: _Path): - from setuptools.extern._validate_pyproject import validate as _validate +def validate(config: dict, filepath: _Path) -> bool: + from . import _validate_pyproject as validator try: - return _validate(config) - except Exception as ex: - if ex.__class__.__name__ != "ValidationError": - # Workaround for the fact that `extern` can duplicate imports - ex_cls = ex.__class__.__name__ - error = ValueError(f"invalid pyproject.toml config: {ex_cls} - {ex}") - raise error from None - + return validator._validate(config) + except validator.ValidationError as ex: _logger.error(f"configuration error: {ex.summary}") # type: ignore _logger.debug(ex.details) # type: ignore error = ValueError(f"invalid pyproject.toml config: {ex.name}") # type: ignore |
