diff options
Diffstat (limited to 'setuptools/config/_validate_pyproject/formats.py')
-rw-r--r-- | setuptools/config/_validate_pyproject/formats.py | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/setuptools/config/_validate_pyproject/formats.py b/setuptools/config/_validate_pyproject/formats.py index 638ac119..486d5260 100644 --- a/setuptools/config/_validate_pyproject/formats.py +++ b/setuptools/config/_validate_pyproject/formats.py @@ -5,6 +5,9 @@ import string import typing from itertools import chain as _chain +if typing.TYPE_CHECKING: + from typing_extensions import Literal + _logger = logging.getLogger(__name__) # ------------------------------------------------------------------------------------- @@ -131,8 +134,10 @@ class _TroveClassifier: option (classifiers will be validated anyway during the upload to PyPI). """ + downloaded: typing.Union[None, "Literal[False]", typing.Set[str]] + def __init__(self): - self.downloaded: typing.Union[None, False, typing.Set[str]] = None + self.downloaded = None self._skip_download = False # None => not cached yet # False => cache not available @@ -182,6 +187,17 @@ except ImportError: # pragma: no cover # ------------------------------------------------------------------------------------- +# Stub packages - PEP 561 + + +def pep561_stub_name(value: str) -> bool: + top, *children = value.split(".") + if not top.endswith("-stubs"): + return False + return python_module_name(".".join([top[: -len("-stubs")], *children])) + + +# ------------------------------------------------------------------------------------- # Non-PEP related |