]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Apply changes from importlib_metadata 0.12.
authorJason R. Coombs <jaraco@jaraco.com>
Tue, 14 May 2019 14:02:00 +0000 (10:02 -0400)
committerJason R. Coombs <jaraco@jaraco.com>
Tue, 14 May 2019 14:02:00 +0000 (10:02 -0400)
Lib/importlib/_bootstrap_external.py
Lib/test/test_importlib/test_zip.py

index b111ea3163f3a1e924bec5e86cf2b53b7659fbd6..45fd087c5fe4ddc0cd749e413158ca307a494306 100644 (file)
@@ -1359,7 +1359,7 @@ class PathFinder:
             return None
         return spec.loader
 
-    search_template = r'{pattern}(-.*)?\.(dist|egg)-info'
+    search_template = r'(?:{pattern}(-.*)?\.(dist|egg)-info|EGG-INFO)'
 
     @classmethod
     def find_distributions(cls, name=None, path=None):
index c7c8c0b1843b204e7788952921abb6d0b4909a86..9b6bce0d4c2faa674746bce77b044f005a27d65d 100644 (file)
@@ -6,13 +6,9 @@ from importlib.metadata import distribution, entry_points, files, version
 from importlib.resources import path
 
 
-class BespokeLoader:
-    archive = 'bespoke'
-
-
 class TestZip(unittest.TestCase):
     def setUp(self):
-        # Find the path to the example.*.whl so we can add it to the front of
+        # Find the path to the example-*.whl so we can add it to the front of
         # sys.path, where we'll then try to find the metadata thereof.
         self.resources = ExitStack()
         self.addCleanup(self.resources.close)
@@ -40,3 +36,21 @@ class TestZip(unittest.TestCase):
         for file in files('example'):
             path = str(file.dist.locate_file(file))
             assert '.whl/' in path, path
+
+
+class TestEgg(TestZip):
+    def setUp(self):
+        # Find the path to the example-*.egg so we can add it to the front of
+        # sys.path, where we'll then try to find the metadata thereof.
+        self.resources = ExitStack()
+        self.addCleanup(self.resources.close)
+        egg = self.resources.enter_context(
+            path('importlib_metadata.tests.data',
+                 'example-21.12-py3.6.egg'))
+        sys.path.insert(0, str(egg))
+        self.resources.callback(sys.path.pop, 0)
+
+    def test_files(self):
+        for file in files('example'):
+            path = str(file.dist.locate_file(file))
+            assert '.egg/' in path, path