summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Mascellani <mascellani@poisson.phc.unipi.it>2011-08-02 14:43:09 +0200
committerSean Finney <seanius@htpc-l.(none)>2011-09-17 13:28:46 +0200
commita03f98d63b0ada2c5dfe804ecad8bd79b591f15c (patch)
treeca9e0da135ef015589180331e96dc27e7a5c6392
parent4a7d41f58846d8a040c9c8f5b4aa2207be2097ce (diff)
downloadpatch-tracker-a03f98d63b0ada2c5dfe804ecad8bd79b591f15c.tar.gz
enumerate_packages() moved in class PatchTrackerDB.
-rwxr-xr-xexport_for_udd.py8
-rw-r--r--patchtracker/DB.py7
2 files changed, 8 insertions, 7 deletions
diff --git a/export_for_udd.py b/export_for_udd.py
index 4220e2f..8f331ca 100755
--- a/export_for_udd.py
+++ b/export_for_udd.py
@@ -5,18 +5,12 @@ from patchtracker.Util import print_used_memory
import sys
import json
-def enumerate_packages(db):
- for packages_per_letter in db.findCollection().pkgs.itervalues():
- for package_name, package_data in packages_per_letter.iteritems():
- for suite, package in package_data.iteritems():
- yield (package_name, suite, package.version)
-
def main():
db = PatchTrackerDB()
packages = []
try:
i = 0
- for package, suite, version in enumerate_packages(db):
+ for package, suite, version in db.enumerate_packages():
# Just for testing and debugging...
#if package not in ['geogebra', 'wotsap', 'netrw', 'haskell-devscripts',
diff --git a/patchtracker/DB.py b/patchtracker/DB.py
index 0913b24..d146613 100644
--- a/patchtracker/DB.py
+++ b/patchtracker/DB.py
@@ -122,6 +122,13 @@ class PatchTrackerDB:
self.db.row_factory = oldfactory
return toc
+ # TODO Probably this can made more efficient
+ def enumerate_packages(self):
+ for packages_per_letter in self.findCollection().pkgs.itervalues():
+ for package_name, package_data in packages_per_letter.iteritems():
+ for suite, package in package_data.iteritems():
+ yield (package_name, suite, package.version)
+
def findLetterToc(self, letter):
return self.findCollection(package=letter+"%").getletter(letter)