Revert: Use join() rather than string printing.
[gentoolkit.git] / pym / gentoolkit / eshowkw / __init__.py
index a6f1ff490d5ac93c5fe27b6643d2924abac10832..cb957a34109d6a374d8f5959e95ba2289b67e8da 100644 (file)
@@ -1,3 +1,4 @@
+#      vim:fileencoding=utf-8
 # Copyright 2010 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
@@ -37,7 +38,7 @@ def process_display(package, keywords, dbapi):
                header_length = portdata.version_length
                content_length = keywords.length
        else:
-               header = string_rotator().rotateContent(portdata.content, portdata.content_length, order, bold)
+               header = string_rotator().rotateContent(portdata.content, portdata.content_length, bold)
                content = keywords.content
                sep = [''.ljust(keywords.length) for x in range(portdata.slot_length-1)]
                content.extend(sep)
@@ -74,15 +75,11 @@ def process_args(argv):
        parser.add_argument('-S', '--ignore-slot', action='store_true', default=False,
                help='Treat slots as irelevant during detection of redundant pacakges.')
 
-       return parser.parse_args(args=argv[1:])
+       return parser.parse_args(args=argv)
 
-def main(argv):
+def main(argv, indirect = False):
        global ignore_slots, bold, order, topper
 
-       # equery support
-       if argv[0] = 'equery':
-               pkgsearch_only = True
-
        #opts parsing
        opts = process_args(argv)
        ignore_slots = opts.ignore_slot
@@ -99,7 +96,7 @@ def main(argv):
        package = opts.package
 
        # equery support
-       if pkgsearch_only and len(package) <= 0:
+       if indirect and len(package) <= 0:
                msg_err = 'No packages specified'
                raise SystemExit(msg_err)
 
@@ -115,16 +112,16 @@ def main(argv):
                map(lambda x: process_display(x, keywords, dbapi), package)
        else:
                currdir = os.getcwd()
-               package=os.path.basename(currdir)
                # check if there are actualy some ebuilds
                ebuilds = ['%s' % x for x in os.listdir(currdir)
                        if fnmatch.fnmatch(x, '*.ebuild')]
                if len(ebuilds) <= 0:
                        msg_err = 'No ebuilds at "%s"' % currdir
                        raise SystemExit(msg_err)
+               package= '%s/%s' % (os.path.basename(os.path.abspath('../')), os.path.basename(currdir))
                ourtree = os.path.abspath('../../')
-
-               mysettings = portc(env={'PORTDIR_OVERLAY': os.path.abspath('../../')})
+               overlays = '%s %s' % (ports['PORTDIR_OVERLAY'], ourtree)
+               mysettings = portc(env={'PORTDIR_OVERLAY': overlays})
                dbapi = portdbapi(mysettings=mysettings)
                # specify that we want just our nice tree we are in cwd
                dbapi.porttrees = [ourtree]
@@ -132,4 +129,4 @@ def main(argv):
        return 0
 
 if __name__ == '__main__':
-       sys.exit(main(sys.argv))
+       sys.exit(main(sys.argv[1:]))