summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2017-10-22 23:10:16 +0200
committerMichał Górny <mgorny@gentoo.org>2017-10-22 23:11:41 +0200
commit3a79d76c870abe965c830d5706d3041d3b726b13 (patch)
tree928eba0b19f47a21ea0f17bbae92d6d6f920b0a8
parent49579c0b949952fdf4710c58c6c797cac6b9b582 (diff)
downloadgemato-3a79d76c870abe965c830d5706d3041d3b726b13.tar.gz
manifest: Support finding distfiles
-rw-r--r--gemato/manifest.py12
-rw-r--r--tests/test_manifest.py6
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):
"""