ferringb pointed out this portroot parameter, ended up not using it, try an os.path...
authorAlec Warner <antarus@gentoo.org>
Tue, 16 Jan 2007 01:36:45 +0000 (01:36 -0000)
committerAlec Warner <antarus@gentoo.org>
Tue, 16 Jan 2007 01:36:45 +0000 (01:36 -0000)
svn path=/main/trunk/; revision=5662

pym/portage.py
pym/portage_news.py

index 3cbe7114d627313a4a330b8d4630dc5f504554c7..501f556856daeabf953e0e58891497f657381c33 100644 (file)
@@ -4527,13 +4527,10 @@ def getmaskingstatus(mycpv, settings=None, portdb=None):
        return rValue
 
 class portagetree:
-       def __init__(self, root="/", virtual=None, clone=None, settings=None, portroot=None):
+       def __init__(self, root="/", virtual=None, clone=None, settings=None):
                """
                Constructor for a PortageTree
                
-               Note: Portroot was added for GLEP 42 functionality and defaults to the $PORTDIR
-               env variable.
-               
                @param root: ${ROOT}, defaults to '/', see make.conf(5)
                @type root: String/Path
                @param virtual: UNUSED
@@ -5549,11 +5546,13 @@ class portdbapi(dbapi):
                        [os.path.realpath(t) for t in self.mysettings["PORTDIR_OVERLAY"].split()]
                self.treemap = {}
                for path in self.porttrees:
-                       try:
-                               repo_name = open( os.path.join( path , REPO_NAME_LOC ) ,'r').readline().rstrip()
-                               self.treemap[repo_name] = path
-                       except (OSError,IOError):
-                               pass
+                       repo_name_path = os.path.join( path, REPO_NAME_LOC )
+                       if os.path.exists( repo_name_path ):
+                               try:
+                                       repo_name = open( repo_name_path ,'r').readline().strip()
+                                       self.treemap[repo_name] = path
+                               except (OSError,IOError):
+                                       pass
                
                self.auxdbmodule  = self.mysettings.load_best_module("portdbapi.auxdbmodule")
                self.auxdb        = {}
index ea804f31b921d13edf29e4df06b82fcec5ef135c..736ce3fdcaf0a2b14c7cde83bf37b1ce040e427b 100644 (file)
@@ -163,21 +163,14 @@ class NewsItem(object):
                        #will never match
                        if not line.startswith("D"):
                                continue
-                       match = _installedRE.match( line )
-                       if match:
-                               self.restrictions.append( 
-                                       DisplayInstalledRestriction( match.groups()[0].strip().rstrip() ) )
-                               continue
-                       match = _profileRE.match( line )
-                       if match:
-                               self.restrictions.append(
-                                       DisplayProfileRestriction( match.groups()[0].strip().rstrip() ) )
-                               continue
-                       match = _keywordRE.match( line )
-                       if match:
-                               self.restrictions.append(
-                                       DisplayKeywordRestriction( match.groups()[0].strip().rstrip() ) )
-                               continue
+                       restricts = {  _installedRE : DisplayInstalledRestriction,
+                                       _profileRE : DisplayProfileRestriction,
+                                       _keywordRE : DisplayKeywordRestriction }
+                       for regex, restriction in restricts.iteritems():
+                               match = regex.match(line)
+                               if match:
+                                       self.restrictions.append( restriction( match.groups()[0].strip() ) )
+                                       continue
                self._parsed = True
 
        def __getattr__( self, attr ):