summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2023-03-06 19:59:54 +0000
committerAnderson Bravalheri <andersonbravalheri@gmail.com>2023-03-07 21:06:25 +0000
commit9aafb559c1c1293c2f6bb720f6573dadc089588a (patch)
tree5109993272a834804656c9ca462c8b39e61344cb
parentc94c8fef02351b880d40a2ba622b492a2d4ffe90 (diff)
downloadpython-setuptools-git-9aafb559c1c1293c2f6bb720f6573dadc089588a.tar.gz
Use new warnings in setuptools/_normalization.py
-rw-r--r--setuptools/_normalization.py29
1 files changed, 13 insertions, 16 deletions
diff --git a/setuptools/_normalization.py b/setuptools/_normalization.py
index 06e535b4..c34f5ff7 100644
--- a/setuptools/_normalization.py
+++ b/setuptools/_normalization.py
@@ -3,13 +3,10 @@ Helpers for normalization as expected in wheel/sdist/module file names
and core metadata
"""
import re
-import warnings
-from inspect import cleandoc
from pathlib import Path
from typing import Union
-from setuptools.extern import packaging
-
+from .extern import packaging
from .warnings import SetuptoolsDeprecationWarning
_Path = Union[str, Path]
@@ -79,18 +76,18 @@ def best_effort_version(version: str) -> str:
try:
return safe_version(version)
except packaging.version.InvalidVersion:
- msg = f"""Invalid version: {version!r}.
- !!\n\n
- ###################
- # Invalid version #
- ###################
- {version!r} is not valid according to PEP 440.\n
- Please make sure specify a valid version for your package.
- Also note that future releases of setuptools may halt the build process
- if an invalid version is given.
- \n\n!!
- """
- warnings.warn(cleandoc(msg), SetuptoolsDeprecationWarning)
+ SetuptoolsDeprecationWarning.emit(
+ f"Invalid version: {version!r}.",
+ f"""
+ Version {version!r} is not valid according to PEP 440.
+
+ Please make sure specify a valid version for your package.
+ Also note that future releases of setuptools may halt the build process
+ if an invalid version is given.
+ """,
+ see_url="https://peps.python.org/pep-0440/",
+ due_date=(2023, 9, 26), # See setuptools/dist _validate_version
+ )
v = version.replace(' ', '.')
return safe_name(v)