From 938a33922c8cba3bbff6dfd1c2f723e5f929d6ce Mon Sep 17 00:00:00 2001 From: Melissa Li Date: Mon, 8 Mar 2021 02:59:16 -0500 Subject: [PATCH] Reduce scope of dash deprecation warning to Setuptools and distutils --- setuptools/dist.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/setuptools/dist.py b/setuptools/dist.py index 70c0e6becb..d1587e3415 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -11,6 +11,7 @@ import distutils.core import distutils.cmd import distutils.dist +import distutils.command from distutils.util import strtobool from distutils.debug import DEBUG from distutils.fancy_getopt import translate_longopt @@ -29,6 +30,7 @@ from . import SetuptoolsDeprecationWarning import setuptools +import setuptools.command from setuptools import windows_support from setuptools.monkey import get_unpatched from setuptools.config import parse_configuration @@ -629,7 +631,13 @@ def dash_to_underscore_warning(self, opt, section): 'options.extras_require', 'options.data_files', ): return opt + underscore_opt = opt.replace('-', '_') + commands = distutils.command.__all__ + setuptools.command.__all__ + if (not section.startswith('options') and section != 'metadata' + and section not in commands): + return underscore_opt + if '-' in opt: warnings.warn( "Usage of dash-separated '%s' will not be supported in future "