From 7eb0687ba9e695a9f9d23dead8f7e69faa53b560 Mon Sep 17 00:00:00 2001 From: Fabio Erculiani Date: Tue, 19 Nov 2013 14:48:20 +0100 Subject: [PATCH] [entropy.db] make listAllDependencies() public --- lib/entropy/db/skel.py | 10 ++++++++++ lib/entropy/db/sql.py | 10 +++------- lib/tests/standalone/test_graph.py | 4 ++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/entropy/db/skel.py b/lib/entropy/db/skel.py index d0788a0b1..77c6a2c5d 100644 --- a/lib/entropy/db/skel.py +++ b/lib/entropy/db/skel.py @@ -4002,6 +4002,16 @@ class EntropyRepositoryBase(TextInterface, EntropyRepositoryPluginStore): """ raise NotImplementedError() + def listAllDependencies(self): + """ + List all dependencies available in repository. + + @return: list of tuples of length 2 containing + (dependency id, dependency,) + @rtype: list + """ + raise NotImplementedError() + def listAllSpmUids(self): """ List all Source Package Manager unique package identifiers bindings diff --git a/lib/entropy/db/sql.py b/lib/entropy/db/sql.py index a71053a28..7e8a8f7c5 100644 --- a/lib/entropy/db/sql.py +++ b/lib/entropy/db/sql.py @@ -4639,13 +4639,9 @@ class EntropySQLRepository(EntropyRepositoryBase): cur = self._cursor().execute("SELECT idpackage FROM systempackages") return self._cur2frozenset(cur) - def _listAllDependencies(self): + def listAllDependencies(self): """ - List all dependencies available in repository. - - @return: list of tuples of length 2 containing - (iddependency, dependency, name,) - @rtype: list + Reimplemented from EntropyRepositoryBase. """ cur = self._cursor().execute(""" SELECT iddependency, dependency FROM dependenciesreference @@ -5512,7 +5508,7 @@ class EntropySQLRepository(EntropyRepositoryBase): return rev_deps_data dep_data = {} - for iddep, atom in self._listAllDependencies(): + for iddep, atom in self.listAllDependencies(): if iddep == -1: continue diff --git a/lib/tests/standalone/test_graph.py b/lib/tests/standalone/test_graph.py index b85079b70..e2e038505 100644 --- a/lib/tests/standalone/test_graph.py +++ b/lib/tests/standalone/test_graph.py @@ -9,7 +9,7 @@ if __name__ == "__main__": # test with zillions of atoms repo = cl.open_repository("sabayonlinux.org") - atoms = [x[1] for x in repo._listAllDependencies()] + atoms = [x[1] for x in repo.listAllDependencies()] atoms = [x for x in atoms if not x.startswith("!")] graph = Graph() @@ -63,4 +63,4 @@ if __name__ == "__main__": print "=" * 20 cl.destroy() - raise SystemExit(0) \ No newline at end of file + raise SystemExit(0)