Filter out some non-category directories in portdbapi.cp_all().
authorZac Medico <zmedico@gentoo.org>
Thu, 20 Dec 2007 14:21:25 +0000 (14:21 -0000)
committerZac Medico <zmedico@gentoo.org>
Thu, 20 Dec 2007 14:21:25 +0000 (14:21 -0000)
svn path=/main/trunk/; revision=8993

pym/portage/dbapi/porttree.py

index 4b66b6125af171e4dc0262af80ea578f7a451710..0834854720c897a52cd1c5219cc847219f3597d6 100644 (file)
@@ -21,13 +21,14 @@ import portage.gpg, portage.checksum
 from portage import eclass_cache, auxdbkeys, auxdbkeylen, doebuild, flatten, \
        listdir, dep_expand, eapi_is_supported, key_expand, dep_check
 
-import os, stat, sys
+import os, re, stat, sys
 from itertools import izip
 
 class portdbapi(dbapi):
        """this tree will scan a portage directory located at root (passed to init)"""
        portdbapi_instances = []
-
+       _non_category_dirs = re.compile(r'(%s)^$' % \
+               "|".join(["eclass", "profiles", "scripts"]))
        def __init__(self, porttree_root, mysettings=None):
                portdbapi.portdbapi_instances.append(self)
 
@@ -487,7 +488,8 @@ class portdbapi(dbapi):
                d = {}
                for oroot in self.porttrees:
                        for x in listdir(oroot, EmptyOnError=1, ignorecvs=1, dirsonly=1):
-                               if not self._category_re.match(x):
+                               if not self._category_re.match(x) or \
+                                       self._non_category_dirs.match(x):
                                        continue
                                for y in listdir(oroot+"/"+x, EmptyOnError=1, ignorecvs=1, dirsonly=1):
                                        d[x+"/"+y] = None