diff --git a/changelog.d/1937.change.rst b/changelog.d/1937.change.rst new file mode 100644 index 0000000000..acd4305968 --- /dev/null +++ b/changelog.d/1937.change.rst @@ -0,0 +1 @@ +Preserved case-sensitivity of keys in setup.cfg so that entry point names are case-sensitive. Changed sensitivity of configparser. NOTE: Any projects relying on case-insensitivity will need to adapt to accept the original case as published. -- by :user:`melissa-kun-li` \ No newline at end of file diff --git a/setuptools/dist.py b/setuptools/dist.py index 050388de16..c31020f0c4 100644 --- a/setuptools/dist.py +++ b/setuptools/dist.py @@ -583,6 +583,7 @@ def _parse_config_files(self, filenames=None): # noqa: C901 self.announce("Distribution.parse_config_files():") parser = ConfigParser() + parser.optionxform = str for filename in filenames: with io.open(filename, encoding='utf-8') as reader: if DEBUG: diff --git a/setuptools/tests/test_config.py b/setuptools/tests/test_config.py index 1dee12718f..649075609a 100644 --- a/setuptools/tests/test_config.py +++ b/setuptools/tests/test_config.py @@ -802,6 +802,24 @@ def test_entry_points(self, tmpdir): with get_dist(tmpdir) as dist: assert dist.entry_points == expected + def test_case_sensitive_entry_points(self, tmpdir): + _, config = fake_env( + tmpdir, + '[options.entry_points]\n' + 'GROUP1 = point1 = pack.module:func, ' + '.point2 = pack.module2:func_rest [rest]\n' + 'group2 = point3 = pack.module:func2\n' + ) + + with get_dist(tmpdir) as dist: + assert dist.entry_points == { + 'GROUP1': [ + 'point1 = pack.module:func', + '.point2 = pack.module2:func_rest [rest]', + ], + 'group2': ['point3 = pack.module:func2'] + } + def test_data_files(self, tmpdir): fake_env( tmpdir,