From: JinWang An Date: Mon, 27 Mar 2023 08:02:32 +0000 (+0900) Subject: Imported Upstream version 54.1.0 X-Git-Tag: upstream/54.1.0^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0ace35b4a184fcbfadf53810009dc1be0d68e6d2;p=platform%2Fupstream%2Fpython-setuptools.git Imported Upstream version 54.1.0 --- diff --git a/.bumpversion.cfg b/.bumpversion.cfg index 25490e4..9a23064 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 54.0.0 +current_version = 54.1.0 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 62f911a..3920b27 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +v54.1.0 +------- + + +Changes +^^^^^^^ +* #1608: Removed the conversion of dashes to underscores in the :code:`extras_require` and :code:`data_files` of :code:`setup.cfg` to support the usage of dashes. Method will warn users when they use a dash-separated key which in the future will only allow an underscore. Note: the method performs the dash to underscore conversion to preserve compatibility, but future versions will no longer support it -- by :user:`melissa-kun-li` + + v54.0.0 ------- diff --git a/docs/conf.py b/docs/conf.py index 18cd7bd..0a5136b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -73,6 +73,9 @@ link_files = { ), } +intersphinx_mapping = { + 'pypa-build': ('https://pypa-build.readthedocs.io/en/latest/', None) +} # Add support for linking usernames github_url = 'https://github.com' @@ -80,7 +83,7 @@ github_sponsors_url = f'{github_url}/sponsors' extlinks = { 'user': (f'{github_sponsors_url}/%s', '@'), # noqa: WPS323 } -extensions += ['sphinx.ext.extlinks'] +extensions += ['sphinx.ext.extlinks', 'sphinx.ext.intersphinx'] # Be strict about any broken references: nitpicky = True diff --git a/docs/userguide/quickstart.rst b/docs/userguide/quickstart.rst index 1d557d4..75dc302 100644 --- a/docs/userguide/quickstart.rst +++ b/docs/userguide/quickstart.rst @@ -59,11 +59,11 @@ This is what your project would look like:: setup.cfg mypackage/__init__.py -Then, you need an installer, such as `pep517 `_ -which you can obtain via ``pip install pep517``. After downloading it, invoke -the installer:: +Then, you need an builder, such as :std:doc:`PyPA build ` +which you can obtain via ``pip install build``. After downloading it, invoke +the builder:: - python -m pep517.build . + python -m build You now have your distribution ready (e.g. a ``tar.gz`` file and a ``.whl`` file in the ``dist`` directory), which you can upload to PyPI! diff --git a/setup.cfg b/setup.cfg index d60a9b2..1895061 100644 --- a/setup.cfg +++ b/setup.cfg @@ -2,7 +2,7 @@ license_files = LICENSE name = setuptools -version = 54.0.0 +version = 54.1.0 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py index eeb21b5..0917804 100644 --- a/setuptools/command/easy_install.py +++ b/setuptools/command/easy_install.py @@ -1190,7 +1190,7 @@ class easy_install(Command): for key, val in ei_opts.items(): if key not in fetch_directives: continue - fetch_options[key.replace('_', '-')] = val[1] + fetch_options[key] = val[1] # create a settings dictionary suitable for `edit_config` settings = dict(easy_install=fetch_options) cfg_filename = os.path.join(base, 'setup.cfg') diff --git a/setuptools/dist.py b/setuptools/dist.py index 6ae3886..c074468 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, section) opt_dict[opt] = (filename, val) # Make the ConfigParser forget everything (so we retain @@ -623,6 +623,19 @@ class Distribution(_Distribution): except ValueError as e: raise DistutilsOptionError(e) from e + def dash_to_underscore_warning(self, opt, section): + if section in ( + 'options.extras_require', 'options.data_files', + ): + 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 + # FIXME: 'Distribution._set_command_options' is too complex (14) def _set_command_options(self, command_obj, option_dict=None): # noqa: C901 """ diff --git a/setuptools/tests/test_build_ext.py b/setuptools/tests/test_build_ext.py index be03893..b6deebe 100644 --- a/setuptools/tests/test_build_ext.py +++ b/setuptools/tests/test_build_ext.py @@ -104,7 +104,7 @@ def test_build_ext_config_handling(tmpdir_cwd): 'setup.cfg': DALS( """ [build] - build-base = foo_build + build_base = foo_build """), } path.build(files) diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index 6db86c7..eac2674 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -210,8 +210,8 @@ class TestMetadata: fake_env( tmpdir, '[metadata]\n' - 'author-email = test@test.com\n' - 'home-page = http://test.test.com/test/\n' + 'author_email = test@test.com\n' + 'home_page = http://test.test.com/test/\n' 'summary = Short summary\n' 'platform = a, b\n' 'classifier =\n' @@ -507,6 +507,25 @@ class TestMetadata: with get_dist(tmpdir): pass + def test_dash_to_underscore_warning(self, tmpdir): + # dash_to_underscore_warning() is a method in setuptools.dist + # remove this test and method when dash convert to underscore in setup.cfg + # is no longer supported + fake_env( + tmpdir, + '[metadata]\n' + 'author-email = test@test.com\n' + 'maintainer_email = foo@foo.com\n' + ) + msg = ("Usage of dash-separated 'author-email' will not be supported " + "in future versions. " + "Please use the underscore name 'author_email' instead") + with pytest.warns(UserWarning, match=msg): + with get_dist(tmpdir) as dist: + metadata = dist.metadata + assert metadata.author_email == 'test@test.com' + assert metadata.maintainer_email == 'foo@foo.com' + class TestOptions: @@ -772,6 +791,20 @@ class TestOptions: } assert dist.metadata.provides_extras == set(['pdf', 'rest']) + def test_dash_preserved_extras_require(self, tmpdir): + fake_env( + tmpdir, + '[options.extras_require]\n' + 'foo-a = foo\n' + 'foo_b = test\n' + ) + + with get_dist(tmpdir) as dist: + assert dist.extras_require == { + 'foo-a': ['foo'], + 'foo_b': ['test'] + } + def test_entry_points(self, tmpdir): _, config = fake_env( tmpdir,