diff --git a/setuptools/_vendor/_validate_pyproject/NOTICE b/setuptools/config/_validate_pyproject/NOTICE similarity index 99% rename from setuptools/_vendor/_validate_pyproject/NOTICE rename to setuptools/config/_validate_pyproject/NOTICE index 8ed8325e93..b426f7fd10 100644 --- a/setuptools/_vendor/_validate_pyproject/NOTICE +++ b/setuptools/config/_validate_pyproject/NOTICE @@ -1,7 +1,7 @@ The code contained in this directory was automatically generated using the following command: - python -m validate_pyproject.vendoring --output-dir=setuptools/_vendor/_validate_pyproject --enable-plugins setuptools distutils --very-verbose + python -m validate_pyproject.vendoring --output-dir=setuptools/config/_validate_pyproject --enable-plugins setuptools distutils --very-verbose Please avoid changing it manually. @@ -31,7 +31,7 @@ by the same projects: - `__init__.py` - `fastjsonschema_validations.py` -The relevant copyright notes and licenses are included below. +The relevant copyright notes and licenses are included bellow. *** diff --git a/setuptools/_vendor/_validate_pyproject/__init__.py b/setuptools/config/_validate_pyproject/__init__.py similarity index 100% rename from setuptools/_vendor/_validate_pyproject/__init__.py rename to setuptools/config/_validate_pyproject/__init__.py diff --git a/setuptools/_vendor/_validate_pyproject/error_reporting.py b/setuptools/config/_validate_pyproject/error_reporting.py similarity index 100% rename from setuptools/_vendor/_validate_pyproject/error_reporting.py rename to setuptools/config/_validate_pyproject/error_reporting.py diff --git a/setuptools/_vendor/_validate_pyproject/extra_validations.py b/setuptools/config/_validate_pyproject/extra_validations.py similarity index 100% rename from setuptools/_vendor/_validate_pyproject/extra_validations.py rename to setuptools/config/_validate_pyproject/extra_validations.py diff --git a/setuptools/_vendor/_validate_pyproject/fastjsonschema_exceptions.py b/setuptools/config/_validate_pyproject/fastjsonschema_exceptions.py similarity index 100% rename from setuptools/_vendor/_validate_pyproject/fastjsonschema_exceptions.py rename to setuptools/config/_validate_pyproject/fastjsonschema_exceptions.py diff --git a/setuptools/_vendor/_validate_pyproject/fastjsonschema_validations.py b/setuptools/config/_validate_pyproject/fastjsonschema_validations.py similarity index 100% rename from setuptools/_vendor/_validate_pyproject/fastjsonschema_validations.py rename to setuptools/config/_validate_pyproject/fastjsonschema_validations.py diff --git a/setuptools/_vendor/_validate_pyproject/formats.py b/setuptools/config/_validate_pyproject/formats.py similarity index 100% rename from setuptools/_vendor/_validate_pyproject/formats.py rename to setuptools/config/_validate_pyproject/formats.py diff --git a/setuptools/config/pyprojecttoml.py b/setuptools/config/pyprojecttoml.py index e20d71d2ff..9666ca182b 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 diff --git a/setuptools/extern/__init__.py b/setuptools/extern/__init__.py index f09b7faa2c..192e55f6e0 100644 --- a/setuptools/extern/__init__.py +++ b/setuptools/extern/__init__.py @@ -71,7 +71,6 @@ def install(self): names = ( 'packaging', 'pyparsing', 'ordered_set', 'more_itertools', 'importlib_metadata', - 'zipp', 'importlib_resources', 'jaraco', 'typing_extensions', 'nspektr', - 'tomli', '_validate_pyproject', + 'zipp', 'importlib_resources', 'jaraco', 'typing_extensions', 'nspektr', 'tomli', ) VendorImporter(__name__, names, 'setuptools._vendor').install()