From 18347fb2cbe534b6d82e0b6972a1d1c7db593892 Mon Sep 17 00:00:00 2001 From: Anderson Bravalheri Date: Mon, 6 Mar 2023 21:12:19 +0000 Subject: Use new warnings in setuptools/installer.py --- setuptools/installer.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/setuptools/installer.py b/setuptools/installer.py index 137f35ac..44ed0da2 100644 --- a/setuptools/installer.py +++ b/setuptools/installer.py @@ -3,7 +3,6 @@ import os import subprocess import sys import tempfile -import warnings from distutils import log from distutils.errors import DistutilsError from functools import partial @@ -25,7 +24,7 @@ def fetch_build_egg(dist, req): """Fetch an egg needed for building. Use pip/wheel to fetch/build a wheel.""" - _DeprecatedInstaller.warn(stacklevel=2) + _DeprecatedInstaller.emit() _warn_wheel_not_available(dist) return _fetch_build_egg_no_warn(dist, req) @@ -33,7 +32,7 @@ def fetch_build_egg(dist, req): def _fetch_build_eggs(dist, requires): import pkg_resources # Delay import to avoid unnecessary side-effects - _DeprecatedInstaller.warn(stacklevel=3) + _DeprecatedInstaller.emit(stacklevel=3) _warn_wheel_not_available(dist) resolved_dists = pkg_resources.working_set.resolve( @@ -131,12 +130,9 @@ def _warn_wheel_not_available(dist): class _DeprecatedInstaller(SetuptoolsDeprecationWarning): - @classmethod - def warn(cls, stacklevel=1): - warnings.warn( - "setuptools.installer and fetch_build_eggs are deprecated. " - "Requirements should be satisfied by a PEP 517 installer. " - "If you are using pip, you can try `pip install --use-pep517`.", - cls, - stacklevel=stacklevel+1 - ) + _SUMMARY = "setuptools.installer and fetch_build_eggs are deprecated." + _DETAILS = """ + Requirements should be satisfied by a PEP 517 installer. + If you are using pip, you can try `pip install --use-pep517`. + """ + # _DUE_DATE not decided yet -- cgit v1.2.1