diff options
| author | Melissa Li <li.melissa.kun@gmail.com> | 2021-03-03 16:42:16 -0500 |
|---|---|---|
| committer | Melissa Li <li.melissa.kun@gmail.com> | 2021-03-03 16:42:16 -0500 |
| commit | 9c2b717818046a0d8679b4a97c63db2dc1e32d54 (patch) | |
| tree | 9a11fc676c50a8d068acf6cf520d17fbb7ba93f1 /setuptools | |
| parent | 4cd5f1a23bced5679f219387afacc59dd360bce5 (diff) | |
| download | python-setuptools-git-9c2b717818046a0d8679b4a97c63db2dc1e32d54.tar.gz | |
Update warning for dash to underscore conversion
Diffstat (limited to 'setuptools')
| -rw-r--r-- | setuptools/dist.py | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/setuptools/dist.py b/setuptools/dist.py index fe5bd6f8..40440a40 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -598,7 +598,7 @@ class Distribution(_Distribution): continue val = parser.get(section, opt) - opt = self.dash_to_underscore_warning(opt) + opt = self.dash_to_underscore_warning(opt, section) opt_dict[opt] = (filename, val) # Make the ConfigParser forget everything (so we retain @@ -622,21 +622,19 @@ class Distribution(_Distribution): setattr(self, alias or opt, val) 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', + + def dash_to_underscore_warning(self, opt, section): + if section in ( + 'options.extras_require', 'options.data_files', ): - underscore_opt = opt.replace('-', '_') + return opt + underscore_opt = opt.replace('-', '_') + if '-' in opt: 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 + return underscore_opt # FIXME: 'Distribution._set_command_options' is too complex (14) def _set_command_options(self, command_obj, option_dict=None): # noqa: C901 |
