+# vim:fileencoding=utf-8
# Copyright 2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-__package__ = 'eshowkw'
-__version__ = '0.5'
+__package__ = 'gentoolkit.eshowkw'
+__version__ = 'svn'
+__author__ = "Tomáš Chvátal <scarabeus@gentoo.org>"
import portage
from portage import portdbapi as portdbapi
from portage import db as portdb
-from keywords_header import keywords_header
-from keywords_content import keywords_content
-from display_pretty import string_rotator
-from display_pretty import display
+from .keywords_header import keywords_header
+from .keywords_content import keywords_content
+from .display_pretty import string_rotator
+from .display_pretty import display
ignore_slots = False
bold = False
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)
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
#opts parsing
prefix = opts.prefix
color = opts.color
package = opts.package
+
+ # equery support
+ if indirect and len(package) <= 0:
+ msg_err = 'No packages specified'
+ raise SystemExit(msg_err)
+
# disable colors when redirected and they are not forced on
if not color and not sys.stdout.isatty():
# disable colors
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(file, '*.ebuild')]
+ 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]
return 0
if __name__ == '__main__':
- sys.exit(main(sys.argv))
+ sys.exit(main(sys.argv[1:]))