diff options
author | Zac Medico <zmedico@gentoo.org> | 2010-02-15 19:29:39 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2010-02-15 19:29:39 +0000 |
commit | d488c9f345f923825b722ae3cff0302d631c4842 (patch) | |
tree | c8e32078a60b14fd79736a7a8745a0d48c5ec4aa | |
parent | 305881f35bd5dac1236d7564b10cca0fba8e36e8 (diff) | |
download | portage-d488c9f345f923825b722ae3cff0302d631c4842.tar.gz portage-d488c9f345f923825b722ae3cff0302d631c4842.tar.bz2 portage-d488c9f345f923825b722ae3cff0302d631c4842.zip |
Add a 'trees' parameter to portdbapi.cp_all(). Thanks to Brian Dolbec (dol-sen)
for this patch.
svn path=/main/trunk/; revision=15356
-rw-r--r-- | pym/portage/dbapi/porttree.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py index 5a845118d..6012cd414 100644 --- a/pym/portage/dbapi/porttree.py +++ b/pym/portage/dbapi/porttree.py @@ -901,13 +901,22 @@ class portdbapi(dbapi): else: return 0 - def cp_all(self, categories=None): - "returns a list of all keys in our tree" + def cp_all(self, categories=None, trees=None): + """ + This returns a list of all keys in our tree or trees + @param categories: optional list of categories to search or + defaults to self.settings.categories + @param trees: optional list of trees to search the categories in or + defaults to self.porttrees + @rtype list of [cat/pkg,...] + """ d = {} if categories is None: categories = self.settings.categories + if trees is None: + trees = self.porttrees for x in categories: - for oroot in self.porttrees: + for oroot in trees: for y in listdir(oroot+"/"+x, EmptyOnError=1, ignorecvs=1, dirsonly=1): if not self._pkg_dir_name_re.match(y) or \ y == "CVS": |