diff options
| author | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2023-01-19 18:17:50 +0000 |
|---|---|---|
| committer | Anderson Bravalheri <andersonbravalheri@gmail.com> | 2023-01-19 18:17:50 +0000 |
| commit | 4fadb9505b02a88858e54fd762e4958886a82bcb (patch) | |
| tree | ebf6d116e9d916bd6f7c947950c8e89bf86fd72d /setuptools | |
| parent | 30c8c9b3f62a0c61ab0515fad4deeec88a5758d4 (diff) | |
| download | python-setuptools-git-4fadb9505b02a88858e54fd762e4958886a82bcb.tar.gz | |
Make deprecation warning more visible and mention --use-pep517
Diffstat (limited to 'setuptools')
| -rw-r--r-- | setuptools/installer.py | 25 |
1 files changed, 20 insertions, 5 deletions
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) |
