diff options
-rw-r--r-- | gemato/manifest.py | 12 | ||||
-rw-r--r-- | tests/test_manifest.py | 6 |
2 files changed, 18 insertions, 0 deletions
diff --git a/gemato/manifest.py b/gemato/manifest.py index b0168a0..5e06937 100644 --- a/gemato/manifest.py +++ b/gemato/manifest.py @@ -344,3 +344,15 @@ class ManifestFile(object): if e.path == path: return e return None + + def find_dist_entry(self, filename): + """ + Find a matching entry for distfile @filename and return it. + Returns None when no DIST entry matches. + """ + + for e in self.entries: + if isinstance(e, ManifestEntryDIST): + if e.path == filename: + return e + return None diff --git a/tests/test_manifest.py b/tests/test_manifest.py index 43c7e18..90368d7 100644 --- a/tests/test_manifest.py +++ b/tests/test_manifest.py @@ -84,6 +84,12 @@ class ManifestTest(unittest.TestCase): self.assertIsNone(m.find_path_entry('test.patch')) self.assertEqual(m.find_path_entry('files/test.patch').aux_path, 'test.patch') + def test_find_dist_entry(self): + m = gemato.manifest.ManifestFile() + m.load(io.StringIO(TEST_MANIFEST)) + self.assertIsNone(m.find_dist_entry('myebuild-0.ebuild')) + self.assertEqual(m.find_dist_entry('mydistfile.tar.gz').path, 'mydistfile.tar.gz') + class ManifestEntryTest(unittest.TestCase): """ |