diff options
author | Zac Medico <zmedico@gentoo.org> | 2011-06-02 14:02:46 -0700 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2011-06-02 14:02:46 -0700 |
commit | c6edcb6ac16b7bd011ab196dab2722374b8e9cec (patch) | |
tree | a32bbd09f9f1df97ac2f61fb9d03d75e079bdb8c /bin/portageq | |
parent | 1edf9e3bd37fede61a21d3b6a84542d29d8f3021 (diff) | |
download | portage-c6edcb6ac16b7bd011ab196dab2722374b8e9cec.tar.gz portage-c6edcb6ac16b7bd011ab196dab2722374b8e9cec.tar.bz2 portage-c6edcb6ac16b7bd011ab196dab2722374b8e9cec.zip |
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.
Diffstat (limited to 'bin/portageq')
-rwxr-xr-x | bin/portageq | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/bin/portageq b/bin/portageq index d6d9c170a..92719fb5b 100755 --- a/bin/portageq +++ b/bin/portageq @@ -21,7 +21,6 @@ except KeyboardInterrupt: sys.exit(128 + signal.SIGINT) import os -import subprocess import types # Avoid sandbox violations after python upgrade. @@ -43,8 +42,11 @@ except ImportError: del pym_path 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', +) def eval_atom_use(atom): if 'USE' in os.environ: @@ -656,10 +658,11 @@ list_preserved_libs.uses_root = True if not portage.const._ENABLE_PRESERVE_LIBS: del list_preserved_libs -non_commands = frozenset(['elog', 'eval_atom_use', 'exithandler', 'main', +non_commands = frozenset(['elog', 'eval_atom_use', + 'exithandler', 'expand_new_virt', 'main', 'usage', 'writemsg', 'writemsg_stdout']) commands = 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)) def usage(argv): print(">>> Portage information query tool") |