summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2023-03-06 20:55:23 +0000
committerAnderson Bravalheri <andersonbravalheri@gmail.com>2023-03-07 21:06:28 +0000
commit80af34e07dadaa2f43a21d6337af0d2e6f8fe143 (patch)
tree9a1a714ae2dac71c8516693c365678eaf487f15a
parenta74b355ca666dc850557c99bebce65df4abc06a1 (diff)
downloadpython-setuptools-git-80af34e07dadaa2f43a21d6337af0d2e6f8fe143.tar.gz
Use new warnings in setuptools/config/__init__.py
-rw-r--r--setuptools/config/__init__.py29
1 files changed, 18 insertions, 11 deletions
diff --git a/setuptools/config/__init__.py b/setuptools/config/__init__.py
index d411aadd..ffea3944 100644
--- a/setuptools/config/__init__.py
+++ b/setuptools/config/__init__.py
@@ -1,9 +1,7 @@
"""For backward compatibility, expose main functions from
``setuptools.config.setupcfg``
"""
-import warnings
from functools import wraps
-from textwrap import dedent
from typing import Callable, TypeVar, cast
from ..warnings import SetuptoolsDeprecationWarning
@@ -17,15 +15,24 @@ __all__ = ('parse_configuration', 'read_configuration')
def _deprecation_notice(fn: Fn) -> Fn:
@wraps(fn)
def _wrapper(*args, **kwargs):
- msg = f"""\
- As setuptools moves its configuration towards `pyproject.toml`,
- `{__name__}.{fn.__name__}` became deprecated.
-
- For the time being, you can use the `{setupcfg.__name__}` module
- to access a backward compatible API, but this module is provisional
- and might be removed in the future.
- """
- warnings.warn(dedent(msg), SetuptoolsDeprecationWarning, stacklevel=2)
+ SetuptoolsDeprecationWarning.emit(
+ "Deprecated API usage.",
+ f"""
+ As setuptools moves its configuration towards `pyproject.toml`,
+ `{__name__}.{fn.__name__}` became deprecated.
+
+ For the time being, you can use the `{setupcfg.__name__}` module
+ to access a backward compatible API, but this module is provisional
+ and might be removed in the future.
+
+ To read project metadata, consider using
+ ``build.util.project_wheel_metadata`` (https://pypi.org/project/build/).
+ For simple scenarios, you can also try parsing the file directly
+ with the help of ``configparser``.
+ """,
+ # due_date not defined yet, because the community still heavily relies on it
+ # Warning introduced in 24 Mar 2022
+ )
return fn(*args, **kwargs)
return cast(Fn, _wrapper)