summaryrefslogtreecommitdiff
path: root/setuptools/dist.py
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-03-06 21:47:15 -0500
committerJason R. Coombs <jaraco@jaraco.com>2021-03-06 21:56:12 -0500
commit0bffc7c1c673f9735bdac71a2949fae809ec07a3 (patch)
treeb22396c1d582776da7cdc5696566e1bd69449eb7 /setuptools/dist.py
parent28c7abc9516821cb701be5576ccd274a3b0c0389 (diff)
downloadpython-setuptools-git-0bffc7c1c673f9735bdac71a2949fae809ec07a3.tar.gz
Apply suggestions in code review.
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
Diffstat (limited to 'setuptools/dist.py')
-rw-r--r--setuptools/dist.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py
index 43a51ad8..70c0e6be 100644
--- a/setuptools/dist.py
+++ b/setuptools/dist.py
@@ -599,7 +599,7 @@ class Distribution(_Distribution):
val = parser.get(section, opt)
opt = self.dash_to_underscore_warning(opt, section)
- opt = self.uppercase_warning(opt, section)
+ opt = self.make_option_lowercase(opt, section)
opt_dict[opt] = (filename, val)
# Make the ConfigParser forget everything (so we retain
@@ -637,16 +637,17 @@ class Distribution(_Distribution):
% (opt, underscore_opt))
return underscore_opt
- def uppercase_warning(self, opt, section):
- if section in ('metadata',) and (any(c.isupper() for c in opt)):
- lowercase_opt = opt.lower()
- warnings.warn(
- "Usage of uppercase key '%s' in '%s' will be deprecated in future "
- "versions. Please use lowercase '%s' instead"
- % (opt, section, lowercase_opt)
- )
- return lowercase_opt
- return opt
+ def make_option_lowercase(self, opt, section):
+ if section != 'metadata' or opt.islower():
+ return opt
+
+ lowercase_opt = opt.lower()
+ warnings.warn(
+ "Usage of uppercase key '%s' in '%s' will be deprecated in future "
+ "versions. Please use lowercase '%s' instead"
+ % (opt, section, lowercase_opt)
+ )
+ return lowercase_opt
# FIXME: 'Distribution._set_command_options' is too complex (14)
def _set_command_options(self, command_obj, option_dict=None): # noqa: C901