Allow portage.getmaskingreason() to operate without global variables.
authorZac Medico <zmedico@gentoo.org>
Sat, 1 Jul 2006 05:03:16 +0000 (05:03 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 1 Jul 2006 05:03:16 +0000 (05:03 -0000)
svn path=/main/trunk/; revision=3727

bin/emerge
pym/portage.py

index 32a72527cc61d4b7472f3e040b4d820dcc93cd80..98ded201b2b0815656406ef0ff7df5372ca633ff 100755 (executable)
@@ -1058,7 +1058,8 @@ class depgraph:
                                                                mreasons = portage.getmaskingstatus(p,
                                                                        settings=self.settings, portdb=self.portdb)
                                                                print "- "+p+" (masked by: "+string.join(mreasons, ", ")+")"
-                                                               comment = portage.getmaskingreason(p)
+                                                               comment = portage.getmaskingreason(p,
+                                                                       settings=self.settings, portdb=self.portdb)
                                                                if comment and comment != oldcomment:
                                                                        print comment
                                                                        oldcomment = comment
index c4d0e4a50cd17f8211e031de9134bce849bbf986..839117a659b73e192d05ef47090553afc1e6e7b2 100644 (file)
@@ -3633,9 +3633,12 @@ def cpv_expand(mycpv, mydb=None, use_cache=1, settings=None):
        else:
                return mykey
 
-def getmaskingreason(mycpv):
+def getmaskingreason(mycpv, settings=None, portdb=None):
        from portage_util import grablines
-       global portdb, settings
+       if settings is None:
+               settings = globals()["settings"]
+       if portdb is None:
+               portdb = globals()["portdb"]
        mysplit = catpkgsplit(mycpv)
        if not mysplit:
                raise ValueError("invalid CPV: %s" % mycpv)