summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Bravalheri <andersonbravalheri@gmail.com>2023-01-19 18:17:50 +0000
committerAnderson Bravalheri <andersonbravalheri@gmail.com>2023-01-19 18:17:50 +0000
commit4fadb9505b02a88858e54fd762e4958886a82bcb (patch)
treeebf6d116e9d916bd6f7c947950c8e89bf86fd72d
parent30c8c9b3f62a0c61ab0515fad4deeec88a5758d4 (diff)
downloadpython-setuptools-git-4fadb9505b02a88858e54fd762e4958886a82bcb.tar.gz
Make deprecation warning more visible and mention --use-pep517
-rw-r--r--pytest.ini2
-rw-r--r--setuptools/installer.py25
2 files changed, 21 insertions, 6 deletions
diff --git a/pytest.ini b/pytest.ini
index 12007ade..b9e845ea 100644
--- a/pytest.ini
+++ b/pytest.ini
@@ -40,7 +40,7 @@ filterwarnings=
ignore:The Windows bytes API has been deprecated:DeprecationWarning
# https://github.com/pypa/setuptools/issues/2823
- ignore:setuptools.installer is deprecated.
+ ignore:(.|\s)*setuptools.installer. is deprecated(.|\s)*
# https://github.com/pypa/setuptools/issues/917
ignore:setup.py install is deprecated.
diff --git a/setuptools/installer.py b/setuptools/installer.py
index b7096df1..28fdf70b 100644
--- a/setuptools/installer.py
+++ b/setuptools/installer.py
@@ -24,11 +24,7 @@ def fetch_build_egg(dist, req): # noqa: C901 # is too complex (16) # FIXME
"""Fetch an egg needed for building.
Use pip/wheel to fetch/build a wheel."""
- warnings.warn(
- "setuptools.installer is deprecated. Requirements should "
- "be satisfied by a PEP 517 installer.",
- SetuptoolsDeprecationWarning,
- )
+ _DeprecatedWorkflow.warn(req, stacklevel=2)
# Warn if wheel is not available
try:
pkg_resources.get_distribution('wheel')
@@ -102,3 +98,22 @@ def strip_marker(req):
req = pkg_resources.Requirement.parse(str(req))
req.marker = None
return req
+
+
+class _DeprecatedWorkflow(SetuptoolsDeprecationWarning):
+ """Deprecated installation or configuration method for requirement: {req}
+ !!\n\n
+ ########################
+ # Deprecated Workflow #
+ ########################
+ `setuptools.installer` is deprecated. Requirements should
+ be satisfied by a PEP 517 installer.
+
+ If you are using `pip install` you can try adding the `--use-pep517` flag.
+ \n\n!!
+ """
+
+ @classmethod
+ def warn(cls, req, stacklevel=1):
+ msg = cls.__doc__.format(req=req)
+ warnings.warn(msg, cls, stacklevel=stacklevel+1)