From a2e9ae4cb75f9b00ddf37713ec307e5f00869737 Mon Sep 17 00:00:00 2001
From: Melissa Li
Date: Tue, 2 Mar 2021 19:36:41 -0500
Subject: Add compatibility method to warn for future underscore change
---
setuptools/dist.py | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
(limited to 'setuptools')
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
"""
--
cgit v1.2.1