Skip to content

Commit 132a6cd

Browse files
Warn for uppercase usage in setup.cfg metadata
1 parent 23ee037 commit 132a6cd

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

setuptools/dist.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ def _parse_config_files(self, filenames=None): # noqa: C901
599599

600600
val = parser.get(section, opt)
601601
opt = self.dash_to_underscore_warning(opt, section)
602+
opt = self.uppercase_warning(opt, section)
602603
opt_dict[opt] = (filename, val)
603604

604605
# Make the ConfigParser forget everything (so we retain
@@ -636,6 +637,17 @@ def dash_to_underscore_warning(self, opt, section):
636637
% (opt, underscore_opt))
637638
return underscore_opt
638639

640+
def uppercase_warning(self, opt, section):
641+
if section in ('metadata',) and (any(c.isupper() for c in opt)):
642+
lowercase_opt = opt.lower()
643+
warnings.warn(
644+
"Usage of uppercase key '%s' in '%s' will be deprecated in future "
645+
"versions. Please use lowercase '%s' instead"
646+
% (opt, section, lowercase_opt)
647+
)
648+
return lowercase_opt
649+
return opt
650+
639651
# FIXME: 'Distribution._set_command_options' is too complex (14)
640652
def _set_command_options(self, command_obj, option_dict=None): # noqa: C901
641653
"""

0 commit comments

Comments
 (0)