Imported Upstream version 54.1.0 upstream/54.1.0
authorJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:32 +0000 (17:02 +0900)
committerJinWang An <jinwang.an@samsung.com>
Mon, 27 Mar 2023 08:02:32 +0000 (17:02 +0900)
.bumpversion.cfg
CHANGES.rst
docs/conf.py
docs/userguide/quickstart.rst
setup.cfg
setuptools/command/easy_install.py
setuptools/dist.py
setuptools/tests/test_build_ext.py
setuptools/tests/test_config.py

index 25490e49c920bc858586e865862fa2a47243d1c9..9a2306437483eff333fe86d130a3991012dfa131 100644 (file)
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 54.0.0
+current_version = 54.1.0
 commit = True
 tag = True
 
index 62f911aa89162c3c92c0a895d5068c50998b116a..3920b27e93167e5fb26bb0a8f9a4e56366679617 100644 (file)
@@ -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
 -------
 
index 18cd7bdc4908c67587965e7e86a5c6ecd3166303..0a5136b0af789223a2466e05f41e7b8aec5aabe1 100644 (file)
@@ -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
index 1d557d47bd6b39579852c3e58c8e84b6e4b0dc15..75dc302f414545be29e6d5859d8ec560ff8b75fd 100644 (file)
@@ -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 <https://pypi.org/project/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 <pypa-build:index>`
+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!
index d60a9b2633d6171c301afe0f5ad5079c785798c1..18950611bc56b921c556db730213388988d9963f 100644 (file)
--- 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
index eeb21b5083a636f36484c801590d5dc9244ea73c..0917804f41268a3ee6d227f0b7387ef1bf26480e 100644 (file)
@@ -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')
index 6ae3886b1f914044c8b42031f79dad8f34cf2b4b..c074468ba91b582479df07f131bdc3f01bf1af9a 100644 (file)
@@ -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
         """
index be03893a1bac4dfe223794973a3567b85484e65e..b6deebe4e21b1a6c394d76bb2cd7d8deb22d4118 100644 (file)
@@ -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)
index 6db86c7c583e75248925936b6ee81ed85bcc3ee8..eac26749d4b032c3973bdbce4f4785bee87ec545 100644 (file)
@@ -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,