Skip to content

Distribution._normalized_name for .egg-info has 'egg' in it. #413

Closed

Description

@jaraco

In jaraco/keyring#526 (comment), I learned that _normalized_name for .egg-info distributions is resolving to <pkg>.egg and thus is unique against the same package with .dist-info, failing the expectation that entry points for a given package are loaded only once.

Activity

  1. jaraco commented on Nov 4, 2022

    @jaraco
    MemberAuthor

    I've managed to put together a test that captures the failure, but the test passes on 4.11.4, failing on 4.11.3 and earlier only:

     importlib_metadata afdb973b3e $ git diff --cached
    diff --git a/tests/test_main.py b/tests/test_main.py
    index 215662dd04..8583146f2a 100644
    --- a/tests/test_main.py
    +++ b/tests/test_main.py
    @@ -121,6 +121,23 @@ class NameNormalizationTests(fixtures.OnSysPath, fixtures.SiteDir, unittest.Test
     
             assert len(after) == len(before)
     
    +    def test_egg_and_dist_same(self):
    +        """
    +        Two distributions varying only by metadata style should resolve
    +        as the same.
    +        """
    +        dist_info = {'storytime.dist-info': dict(METADATA='VERSION: 1.0\n')}
    +        fixtures.build_files(dist_info, self.site_dir)
    +        egg_info = {'storytime.egg-info': dict(METADATA='VERSION: 1.0\n')}
    +        fixtures.build_files(egg_info, self.site_dir)
    +        dists = [
    +            dist
    +            for dist in distributions()
    +            if dist._normalized_name.startswith('storytime')
    +        ]
    +        assert len(dists) == 2
    +        assert all(dist._normalized_name == 'storytime' for dist in dists)
    +
  2. jaraco commented on Nov 4, 2022

    @jaraco
    MemberAuthor

    Indeed, the issue is a duplicate of #377.

  3. added
    duplicateThis issue or pull request already exists
    on Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions