summaryrefslogtreecommitdiff
path: root/setuptools
diff options
context:
space:
mode:
authorMelissa Li <li.melissa.kun@gmail.com>2021-03-02 19:36:41 -0500
committerMelissa Li <li.melissa.kun@gmail.com>2021-03-02 21:13:19 -0500
commita2e9ae4cb75f9b00ddf37713ec307e5f00869737 (patch)
tree5d398b02aeb881d6137cc330552f92125971b5f0 /setuptools
parent8307bd497dba77f5ef40f504842e023334eba04b (diff)
downloadpython-setuptools-git-a2e9ae4cb75f9b00ddf37713ec307e5f00869737.tar.gz
Add compatibility method to warn for future underscore change
Diffstat (limited to 'setuptools')
-rw-r--r--setuptools/dist.py17
1 files changed, 16 insertions, 1 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 6ae3886b..fe5bd6f8 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -598,7 +598,7 @@ class Distribution(_Distribution):
continue
val = parser.get(section, opt)
- opt = opt.replace('-', '_')
+ opt = self.dash_to_underscore_warning(opt)
opt_dict[opt] = (filename, val)
# Make the ConfigParser forget everything (so we retain
@@ -623,6 +623,21 @@ class Distribution(_Distribution):
except ValueError as e:
raise DistutilsOptionError(e) from e
+ def dash_to_underscore_warning(self, opt):
+ if opt in (
+ 'home-page', 'download-url', 'author-email',
+ 'maintainer-email', 'long-description', 'build-base',
+ 'project-urls', 'license-file', 'license-files',
+ 'long-description-content-type',
+ ):
+ underscore_opt = opt.replace('-', '_')
+ warnings.warn(
+ "Usage of dash-separated '%s' will not be supported in future "
+ "versions. Please use the underscore name '%s' instead"
+ % (opt, underscore_opt))
+ return underscore_opt
+ return opt
+
# FIXME: 'Distribution._set_command_options' is too complex (14)
def _set_command_options(self, command_obj, option_dict=None): # noqa: C901
"""