Skip to content

Commit 438edb9

Browse files
committed
Merge branch 'master' into feature/no-api-module
2 parents f34305e + 625df69 commit 438edb9

File tree

7 files changed

+30
-41
lines changed

7 files changed

+30
-41
lines changed

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
include *.py MANIFEST.in LICENSE README.rst
2-
global-include *.txt *.rst *.ini *.cfg *.toml *.whl
2+
global-include *.txt *.rst *.ini *.cfg *.toml *.whl *.egg
33
exclude .gitignore
44
prune build
55
prune .tox

README.rst

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,36 +26,6 @@ tools (or other conforming packages). It does not support:
2626

2727
- Packages in the stdlib.
2828
- Packages installed without metadata.
29-
- Packages installed as eggs.
30-
31-
Eggs
32-
----
33-
34-
Not only does ``importlib_metadata`` not support loading metadata
35-
from eggs, it will crash when it attempts to load metadata for
36-
any package that's an egg.
37-
38-
``easy_install`` creates eggs when installing packages, which is why
39-
you should use ``pip`` to install packages. ``pip`` never installs
40-
eggs. There are some cases, however, where a project's usage
41-
may not be able to avoid ``easy_install``. In particular, if a project
42-
uses ``setup.py test``, any ``install_requires`` of that project that
43-
aren't already installed will be installed using ``easy_install``.
44-
Additionally, any project defining ``setup_requires`` may get those
45-
dependencies installed as eggs if those dependencies aren't met before
46-
setup.py is invoked (for any command).
47-
48-
Because ``importlib_metadata`` doesn't support loading metadata from
49-
eggs and because ``importlib_metadata`` calls itself to get its own version,
50-
simply importing ``importlib_metadata`` will fail if it is installed as an
51-
egg. Any package that incorporates ``importlib_metadata`` (directly
52-
or indirectly) should be prepared to guide its users to tools that avoid
53-
installing eggs (such as `pip <https://pypi.org/project/pip>`_ and
54-
`tox <https://pypi.org/project/tox>`_).
55-
56-
More detail and discussion can be found at
57-
`issue 19 <https://gitlab.com/python-devs/importlib_metadata/issues/19>`_.
58-
5929

6030
Project details
6131
===============

importlib_metadata/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ class MetadataPathFinder(NullFinder, DistributionFinder):
337337
This finder supplies only a find_distributions() method for versions
338338
of Python that do not have a PathFinder find_distributions().
339339
"""
340-
search_template = r'{pattern}(-.*)?\.(dist|egg)-info'
340+
search_template = r'(?:{pattern}(-.*)?\.(dist|egg)-info|EGG-INFO)'
341341

342342
def find_distributions(self, name=None, path=None):
343343
"""Return an iterable of all Distribution instances capable of

importlib_metadata/docs/changelog.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
importlib_metadata NEWS
33
=========================
44

5+
0.12
6+
====
7+
* Add support for eggs. !65; Closes #19.
8+
59
0.11
610
====
711
* Support generic zip files (not just wheels). Closes #59
1.46 KB
Binary file not shown.

importlib_metadata/tests/test_zip.py

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,16 @@
1414
from contextlib2 import ExitStack
1515

1616

17-
class BespokeLoader:
18-
archive = 'bespoke'
19-
20-
2117
class TestZip(unittest.TestCase):
18+
root = 'importlib_metadata.tests.data'
19+
2220
def setUp(self):
23-
# Find the path to the example.*.whl so we can add it to the front of
21+
# Find the path to the example-*.whl so we can add it to the front of
2422
# sys.path, where we'll then try to find the metadata thereof.
2523
self.resources = ExitStack()
2624
self.addCleanup(self.resources.close)
2725
wheel = self.resources.enter_context(
28-
path('importlib_metadata.tests.data',
29-
'example-21.12-py3-none-any.whl'))
26+
path(self.root, 'example-21.12-py3-none-any.whl'))
3027
sys.path.insert(0, str(wheel))
3128
self.resources.callback(sys.path.pop, 0)
3229

@@ -48,3 +45,20 @@ def test_files(self):
4845
for file in files('example'):
4946
path = str(file.dist.locate_file(file))
5047
assert '.whl/' in path, path
48+
49+
50+
class TestEgg(TestZip):
51+
def setUp(self):
52+
# Find the path to the example-*.egg so we can add it to the front of
53+
# sys.path, where we'll then try to find the metadata thereof.
54+
self.resources = ExitStack()
55+
self.addCleanup(self.resources.close)
56+
egg = self.resources.enter_context(
57+
path(self.root, 'example-21.12-py3.6.egg'))
58+
sys.path.insert(0, str(egg))
59+
self.resources.callback(sys.path.pop, 0)
60+
61+
def test_files(self):
62+
for file in files('example'):
63+
path = str(file.dist.locate_file(file))
64+
assert '.egg/' in path, path

setup.cfg

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ packages = find:
2828
importlib_metadata =
2929
docs/*
3030
docs/_static/*
31-
importlib_metadata.tests.data03 =
32-
namespace/*
31+
importlib_metadata.tests.data =
32+
*.egg
33+
*.whl
3334

3435
[mypy]
3536
ignore_missing_imports = True

0 commit comments

Comments
 (0)