Merge from genscripts r451: douglasjanderson
authorfuzzyray <fuzzyray@gentoo.org>
Wed, 22 Sep 2010 20:56:38 +0000 (20:56 -0000)
committerfuzzyray <fuzzyray@gentoo.org>
Wed, 22 Sep 2010 20:56:38 +0000 (20:56 -0000)
Revert r438 because the problem it addresses can be taken care of more robustly.

Merge from genscripts r449: douglasjanderson
Make some modifications to fix bug #309091

Merge from genscripts r438: brian.dolbec
rework the dpendencies _parser() tok == '' trap in an attempt to trap the
InvalidAtom error, add '' removal from matches in query, add more detail in the
error from Atom, add a trap to skirt around a null atom in the ChangeLog class.
Hopefully I either solved it or have it printing out more info this time.

Merge from genscripts r436: brian.dolbec
fix the error in the raising of the GentoolkitInvalidAtom error, find and change
the info printed out in the error message to help track down the problem.

Merge from genscripts r435: brian.dolbec
modify the tok if statement as it didn't catch the error the user was using to
print out additional info

Merge from genscripts r434: brian.dolbec
try to solve an svn diff! Invalid Atom, '' error a user is getting running
equery depends.  this should intercept the empty tok before and print out more
useable info to determine if it should be an error or should be ignored, etc.

svn path=/trunk/gentoolkit/; revision=802

pym/gentoolkit/dependencies.py

index f12500622e0c3e4f7b3e90d7b588bf8950d5a8f1..feced635017f7a601022383200c3d92fd11c2d27 100644 (file)
@@ -27,7 +27,7 @@ from gentoolkit.query import Query
 # Classes
 # =======
 
-class Dependencies(CPV):
+class Dependencies(Query):
        """Access a package's dependencies and reverse dependencies.
 
        Example usage:
@@ -40,14 +40,8 @@ class Dependencies(CPV):
                [<Atom '>=dev-lang/python-2.5'>, <Atom '<dev-lang/python-3.0'>, ...]
 
        """
-       def __init__(self, cpv, op='', parser=None):
-               if isinstance(cpv, CPV):
-                       self.__dict__.update(cpv.__dict__)
-               else:
-                       CPV.__init__(self, cpv)
-
-               self.operator = op
-               self.atom = self.operator + self.cpv
+       def __init__(self, query, parser=None):
+               Query.__init__(self, query)
                self.use = []
                self.depatom = str()
 
@@ -320,10 +314,16 @@ class Dependencies(CPV):
                        if tok[0] == '!':
                                # We're not interested in blockers
                                continue
-                       atom = Atom(tok)
-                       if use_conditional is not None:
-                               atom.use_conditional = use_conditional
-                       result.append(atom)
+                       # skip it if it's empty
+                       if tok and tok != '':
+                               atom = Atom(tok)
+                               if use_conditional is not None:
+                                       atom.use_conditional = use_conditional
+                               result.append(atom)
+                       else:
+                               message = "dependencies.py: _parser() found an empty " +\
+                                       "dep string token for: %s, deps= %s"
+                               raise errors.GentoolkitInvalidAtom(message %(self.cpv, deps))
 
                return result