From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1S9WQ3-0006kr-Mp for garchives@archives.gentoo.org; Mon, 19 Mar 2012 06:50:16 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A255CE0BEE; Mon, 19 Mar 2012 06:50:03 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 6F6F6E0C18 for ; Mon, 19 Mar 2012 06:50:03 +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 942401B4040 for ; Mon, 19 Mar 2012 06:50:02 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 79BEBE5403 for ; Mon, 19 Mar 2012 06:50:00 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1332139658.167e4c05ba1057eac50cfadee3c074a2edda1fe8.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/which.py X-VCS-Directories: pym/gentoolkit/equery/ X-VCS-Committer: dol-sen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: 167e4c05ba1057eac50cfadee3c074a2edda1fe8 X-VCS-Branch: gentoolkit Date: Mon, 19 Mar 2012 06:50:00 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: eab99388-f43b-4c49-9f64-f03815a78737 X-Archives-Hash: 452165a25929855c1b78e4e327956917 commit: 167e4c05ba1057eac50cfadee3c074a2edda1fe8 Author: Brian Dolbec gentoo org> AuthorDate: Mon Mar 19 06:47:38 2012 +0000 Commit: Brian Dolbec gmail com> CommitDate: Mon Mar 19 06:47:38 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/gentoolkit.gi= t;a=3Dcommit;h=3D167e4c05 add an ebuild listing option to equery which as requested by Calchan and = ryao. --- pym/gentoolkit/equery/which.py | 23 +++++++++++++++++++---- 1 files changed, 19 insertions(+), 4 deletions(-) diff --git a/pym/gentoolkit/equery/which.py b/pym/gentoolkit/equery/which= .py index 5259d46..da60a1b 100644 --- a/pym/gentoolkit/equery/which.py +++ b/pym/gentoolkit/equery/which.py @@ -30,7 +30,10 @@ from gentoolkit.query import Query # Globals # =3D=3D=3D=3D=3D=3D=3D =20 -QUERY_OPTS =3D {"include_masked": False} +QUERY_OPTS =3D { + "include_masked": False, + "ebuild":False + } =20 # =3D=3D=3D=3D=3D=3D=3D=3D=3D # Functions @@ -51,9 +54,17 @@ def print_help(with_description=3DTrue): print(pp.command("options")) print(format_options(( (" -h, --help", "display this help message"), - (" -m, --include-masked", "return highest version ebuild available") + (" -m, --include-masked", "return highest version ebuild available"), + (" -e, --ebuild", "print the ebuild") ))) =20 +def print_ebuild(ebuild_path): + """Output the ebuild to std_out""" + with open(ebuild_path) as f: + lines =3D f.readlines() + print("\n\n") + print("".join(lines)) + print("\n") =20 def parse_module_options(module_opts): """Parse module options and update QUERY_OPTS""" @@ -65,13 +76,15 @@ def parse_module_options(module_opts): sys.exit(0) elif opt in ('-m', '--include-masked'): QUERY_OPTS['include_masked'] =3D True + elif opt in ('-e', '--ebuild'): + QUERY_OPTS['ebuild'] =3D True =20 =20 def main(input_args): """Parse input and run the program""" =20 - short_opts =3D "hm" - long_opts =3D ('help', 'include-masked') + short_opts =3D "hme" + long_opts =3D ('help', 'include-masked', 'ebuild') =20 try: module_opts, queries =3D gnu_getopt(input_args, short_opts, long_opts) @@ -97,6 +110,8 @@ def main(input_args): ebuild_path =3D pkg.ebuild_path() if ebuild_path: pp.uprint(os.path.normpath(ebuild_path)) + if QUERY_OPTS['ebuild']: + print_ebuild(ebuild_path) else: sys.stderr.write( pp.warn("No ebuilds to satisfy %s" % pkg.cpv)