MetadataRegen: simplify _iter_every_cp
authorZac Medico <zmedico@gentoo.org>
Mon, 7 Jan 2013 00:28:04 +0000 (16:28 -0800)
committerZac Medico <zmedico@gentoo.org>
Mon, 7 Jan 2013 00:28:04 +0000 (16:28 -0800)
pym/_emerge/MetadataRegen.py
pym/portage/package/ebuild/_parallel_manifest/ManifestScheduler.py

index 213fc3df9a36a32e77b16e3bd1ad2d28bea23252..bdf2fa7eaf3f24377cb4bfbb263a3b04c3c46d97 100644 (file)
@@ -35,14 +35,10 @@ class MetadataRegen(AsyncScheduler):
        def _iter_every_cp(self):
                # List categories individually, in order to start yielding quicker,
                # and in order to reduce latency in case of a signal interrupt.
-               categories = sorted(self._portdb.settings.categories, reverse=True)
                cp_all = self._portdb.cp_all
-
-               while categories:
-                       category = categories.pop()
-                       category_cps = cp_all(categories=(category,), reverse=True)
-                       while category_cps:
-                               yield category_cps.pop()
+               for category in sorted(self._portdb.categories):
+                       for cp in cp_all(categories=(category,)):
+                               yield cp
 
        def _iter_metadata_processes(self):
                portdb = self._portdb
index 8839989a1666fcdb40c9ebb1d260f076895b65fd..38ac4825e76ef40f93154535b1e307ad4a6c8d60 100644 (file)
@@ -32,14 +32,10 @@ class ManifestScheduler(AsyncScheduler):
        def _iter_every_cp(self):
                # List categories individually, in order to start yielding quicker,
                # and in order to reduce latency in case of a signal interrupt.
-               categories = sorted(self._portdb.settings.categories, reverse=True)
                cp_all = self._portdb.cp_all
-
-               while categories:
-                       category = categories.pop()
-                       category_cps = cp_all(categories=(category,), reverse=True)
-                       while category_cps:
-                               yield category_cps.pop()
+               for category in sorted(self._portdb.categories):
+                       for cp in cp_all(categories=(category,)):
+                               yield cp
 
        def _iter_tasks(self):
                portdb = self._portdb