@@ -519,7 +519,7 @@ def _parse_config_files(self, filenames=None): # noqa: C901
519
519
raise DistutilsOptionError (e ) from e
520
520
521
521
def _enforce_underscore (self , opt : str , section : str ) -> str :
522
- if "-" not in opt or not self ._config_requires_normalization (section ):
522
+ if "-" not in opt or self ._skip_setupcfg_normalization (section ):
523
523
return opt
524
524
525
525
raise InvalidConfigError (
@@ -529,7 +529,7 @@ def _enforce_underscore(self, opt: str, section: str) -> str:
529
529
)
530
530
531
531
def _enforce_option_lowercase (self , opt : str , section : str ) -> str :
532
- if opt .islower () or not self ._config_requires_normalization (section ):
532
+ if opt .islower () or self ._skip_setupcfg_normalization (section ):
533
533
return opt
534
534
535
535
raise InvalidConfigError (
@@ -538,15 +538,15 @@ def _enforce_option_lowercase(self, opt: str, section: str) -> str:
538
538
# Warning initially introduced in 6 Mar 2021
539
539
)
540
540
541
- def _config_requires_normalization (self , section : str ) -> bool :
541
+ def _skip_setupcfg_normalization (self , section : str ) -> bool :
542
542
skip = (
543
543
'options.extras_require' ,
544
544
'options.data_files' ,
545
545
'options.entry_points' ,
546
546
'options.package_data' ,
547
547
'options.exclude_package_data' ,
548
548
)
549
- return section not in skip and self ._is_setuptools_section (section )
549
+ return section in skip or not self ._is_setuptools_section (section )
550
550
551
551
def _is_setuptools_section (self , section : str ) -> bool :
552
552
return (
0 commit comments