Add support for showing USE_EXPAND variables. Patch from Michael A. Smith <michael...
authorbetelgeuse <betelgeuse@gentoo.org>
Thu, 27 Nov 2008 13:52:01 +0000 (13:52 -0000)
committerbetelgeuse <betelgeuse@gentoo.org>
Thu, 27 Nov 2008 13:52:01 +0000 (13:52 -0000)
svn path=/; revision=524

trunk/src/equery/equery

index b1bc730e5bcc36afd654d76bf7a8b48f94262983..a1239d91045dd962de98521fc4901933fa968737 100755 (executable)
@@ -17,6 +17,7 @@ import os
 import re
 import sys
 import time
+from glob import glob
 
 # portage (output module) and gentoolkit need special path modifications
 sys.path.insert(0, "/usr/lib/gentoolkit/pym")
@@ -534,6 +535,17 @@ class CmdDisplayUSEs(Command):
                # for all files in gentoolkit.settings["PORTDIR"]+"/desc/*.desc
                # variable name = <filename>_<field1>
                # description = <field 2>
+               for descfile in glob(gentoolkit.settings["PORTDIR"]+"/profiles/desc/*.desc"):
+                       try:
+                               fd = open(descfile)
+                               for line in fd.readlines():
+                                       if line[0] == "#":
+                                               continue
+                                       fields = [field.strip() for field in line.split(" - ", 1)]
+                                       if len(fields) == 2:
+                                                       usedesc["%s_%s" % (descfile.split("/")[-1][0:-5], fields[0],)] = fields[1]
+                       except IOError:
+                               print_warn(5, "Could not load USE flag descriptions from " + descfile)
 
                # Load local USE flag descriptions
                try: