@@ -24,11 +24,7 @@ def fetch_build_egg(dist, req): # noqa: C901 # is too complex (16) # FIXME
24
24
"""Fetch an egg needed for building.
25
25
26
26
Use pip/wheel to fetch/build a wheel."""
27
- warnings .warn (
28
- "setuptools.installer is deprecated. Requirements should "
29
- "be satisfied by a PEP 517 installer." ,
30
- SetuptoolsDeprecationWarning ,
31
- )
27
+ _DeprecatedWorkflow .warn (req , stacklevel = 2 )
32
28
# Warn if wheel is not available
33
29
try :
34
30
pkg_resources .get_distribution ('wheel' )
@@ -102,3 +98,22 @@ def strip_marker(req):
102
98
req = pkg_resources .Requirement .parse (str (req ))
103
99
req .marker = None
104
100
return req
101
+
102
+
103
+ class _DeprecatedWorkflow (SetuptoolsDeprecationWarning ):
104
+ """Deprecated installation or configuration method for requirement: {req}
105
+ !!\n \n
106
+ ########################
107
+ # Deprecated Workflow #
108
+ ########################
109
+ `setuptools.installer` is deprecated. Requirements should
110
+ be satisfied by a PEP 517 installer.
111
+
112
+ If you are using `pip install` you can try adding the `--use-pep517` flag.
113
+ \n \n !!
114
+ """
115
+
116
+ @classmethod
117
+ def warn (cls , req , stacklevel = 1 ):
118
+ msg = cls .__doc__ .format (req = req )
119
+ warnings .warn (msg , cls , stacklevel = stacklevel + 1 )
0 commit comments