Skip to content

Commit

Permalink
Merge pull request #2580 from melissa-kun-li/fix-entry-points-name-ca…
Browse files Browse the repository at this point in the history
…se-sensitivity

Fix case sensitivity of entry point names and keys in setup.cfg. Fixes #1937 and fixes #2480.
  • Loading branch information
jaraco authored Feb 25, 2021
2 parents e46a4f1 + 898a0b5 commit 72c7a6c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.d/1937.change.rst
Original file line number Diff line number Diff line change
@@ -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`
1 change: 1 addition & 0 deletions setuptools/dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
18 changes: 18 additions & 0 deletions setuptools/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 72c7a6c

Please sign in to comment.