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 <gentoo-commits+bounces-349945-garchives=archives.gentoo.org@lists.gentoo.org>)
	id 1QSF2m-0001q2-Tp
	for garchives@archives.gentoo.org; Thu, 02 Jun 2011 21:03:05 +0000
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id B19DC1C123;
	Thu,  2 Jun 2011 21:02:57 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	by pigeon.gentoo.org (Postfix) with ESMTP id 81E6A1C123
	for <gentoo-commits@lists.gentoo.org>; Thu,  2 Jun 2011 21:02:57 +0000 (UTC)
Received: from pelican.gentoo.org (unknown [66.219.59.40])
	(using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id F17321B4018
	for <gentoo-commits@lists.gentoo.org>; Thu,  2 Jun 2011 21:02:56 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by pelican.gentoo.org (Postfix) with ESMTP id 2562180506
	for <gentoo-commits@lists.gentoo.org>; Thu,  2 Jun 2011 21:02:56 +0000 (UTC)
From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" <zmedico@gentoo.org>
Message-ID: <c6edcb6ac16b7bd011ab196dab2722374b8e9cec.zmedico@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: bin/
X-VCS-Repository: proj/portage
X-VCS-Files: bin/portageq
X-VCS-Directories: bin/
X-VCS-Committer: zmedico
X-VCS-Committer-Name: Zac Medico
X-VCS-Revision: c6edcb6ac16b7bd011ab196dab2722374b8e9cec
Date: Thu,  2 Jun 2011 21:02:56 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: quoted-printable
X-Archives-Salt: 
X-Archives-Hash: ed91d7d3243a4c06cc4e2cf0ff8c4e70

commit:     c6edcb6ac16b7bd011ab196dab2722374b8e9cec
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Thu Jun  2 21:02:46 2011 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Thu Jun  2 21:02:46 2011 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a=
=3Dcommit;h=3Dc6edcb6a

portageq: exclude expand_new_virt from commands

This is necessary since portage probes functions in globals() and
treats functions it finds as commands. Also, use lazy import to
minimize global scope imports.

---
 bin/portageq |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/bin/portageq b/bin/portageq
index d6d9c17..92719fb 100755
--- a/bin/portageq
+++ b/bin/portageq
@@ -21,7 +21,6 @@ except KeyboardInterrupt:
 	sys.exit(128 + signal.SIGINT)
=20
 import os
-import subprocess
 import types
=20
 # Avoid sandbox violations after python upgrade.
@@ -43,8 +42,11 @@ except ImportError:
 del pym_path
=20
 from portage import os
-from portage.dbapi._expand_new_virt import expand_new_virt
 from portage.util import writemsg, writemsg_stdout
+portage.proxy.lazyimport.lazyimport(globals(),
+	'subprocess',
+	'portage.dbapi._expand_new_virt:expand_new_virt',
+)
=20
 def eval_atom_use(atom):
 	if 'USE' in os.environ:
@@ -656,10 +658,11 @@ list_preserved_libs.uses_root =3D True
 if not portage.const._ENABLE_PRESERVE_LIBS:
 	del list_preserved_libs
=20
-non_commands =3D frozenset(['elog', 'eval_atom_use', 'exithandler', 'mai=
n',
+non_commands =3D frozenset(['elog', 'eval_atom_use',
+	'exithandler', 'expand_new_virt', 'main',
 	'usage', 'writemsg', 'writemsg_stdout'])
 commands =3D sorted(k for k, v in globals().items() \
-	if type(v) is types.FunctionType and k not in non_commands)
+	if k not in non_commands and isinstance(v, types.FunctionType))
=20
 def usage(argv):
 	print(">>> Portage information query tool")