From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id AA66B1381F3 for ; Sun, 18 Aug 2013 16:32:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 28B1AE0B45; Sun, 18 Aug 2013 16:31:57 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 9BD2DE0B45 for ; Sun, 18 Aug 2013 16:31:56 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 8A4C933EA7C for ; Sun, 18 Aug 2013 16:31:55 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 086BEE468F for ; Sun, 18 Aug 2013 16:31:54 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1376843444.91d27979bc7b8534f531074936b3e4ca826fb470.dol-sen@gentoo> Subject: [gentoo-commits] proj/gentoolkit:gentoolkit commit in: pym/gentoolkit/equery/ X-VCS-Repository: proj/gentoolkit X-VCS-Files: pym/gentoolkit/equery/meta.py X-VCS-Directories: pym/gentoolkit/equery/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 91d27979bc7b8534f531074936b3e4ca826fb470 X-VCS-Branch: gentoolkit Date: Sun, 18 Aug 2013 16:31:54 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 4f8af18c-9f8b-46e6-a102-8dc980734c6c X-Archives-Hash: b2c433aa8353f552725568d6d5b28e23 commit: 91d27979bc7b8534f531074936b3e4ca826fb470 Author: Brian Dolbec gentoo org> AuthorDate: Sun Aug 18 16:30:44 2013 +0000 Commit: Brian Dolbec gmail com> CommitDate: Sun Aug 18 16:30:44 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/gentoolkit.git;a=commit;h=91d27979 Add license field to equery meta as requested by hasufell --- pym/gentoolkit/equery/meta.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pym/gentoolkit/equery/meta.py b/pym/gentoolkit/equery/meta.py index 9beb3eb..e2d2124 100644 --- a/pym/gentoolkit/equery/meta.py +++ b/pym/gentoolkit/equery/meta.py @@ -41,6 +41,7 @@ QUERY_OPTS = { 'description': False, 'herd': False, 'keywords': False, + 'license': False, 'maintainer': False, 'stablereq': False, 'useflags': False, @@ -86,6 +87,7 @@ def print_help(with_description=True, with_usage=True): (" -d, --description", "show an extended package description"), (" -H, --herd", "show the herd(s) for the package"), (" -k, --keywords", "show keywords for all matching package versions"), + (" -l, --license", "show licenses for the best maching version"), (" -m, --maintainer", "show the maintainer(s) for the package"), (" -S, --stablreq", "show STABLEREQ arches (cc's) for all matching package versions"), (" -u, --useflags", "show per-package USE flag descriptions"), @@ -371,6 +373,13 @@ def call_format_functions(best_match, matches): useflags = format_useflags(best_match.metadata.use()) print_sequence(format_list(useflags)) + _license = best_match.environment(["LICENSE"]) + if QUERY_OPTS["license"]: + _license = format_list(_license) + else: + _license = format_list(_license, "License: ", " " * 13) + print_sequence(_license) + if QUERY_OPTS["stablereq"]: # Get {: [u'ia64', u'm68k', ...], ...} stablereq_map = stablereq(matches) @@ -499,6 +508,8 @@ def parse_module_options(module_opts): QUERY_OPTS["description"] = True elif opt in ('-H', '--herd'): QUERY_OPTS["herd"] = True + elif opt in ('-l', '--license'): + QUERY_OPTS["license"] = True elif opt in ('-m', '--maintainer'): QUERY_OPTS["maintainer"] = True elif opt in ('-k', '--keywords'): @@ -516,9 +527,9 @@ def parse_module_options(module_opts): def main(input_args): """Parse input and run the program.""" - short_opts = "hdHkmSuUx" - long_opts = ('help', 'description', 'herd', 'keywords', 'maintainer', - 'stablereq', 'useflags', 'upstream', 'xml') + short_opts = "hdHklmSuUx" + long_opts = ('help', 'description', 'herd', 'keywords', 'license', + 'maintainer', 'stablereq', 'useflags', 'upstream', 'xml') try: module_opts, queries = gnu_getopt(input_args, short_opts, long_opts)