Skip to content

Commit

Permalink
Reduce scope of dash deprecation warning to Setuptools and distutils
Browse files Browse the repository at this point in the history
  • Loading branch information
melissa-kun-li committed Mar 8, 2021
1 parent b2f7b8f commit 938a339
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions setuptools/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 "
Expand Down

0 comments on commit 938a339

Please sign in to comment.