summaryrefslogtreecommitdiff
path: root/bin/equery
diff options
context:
space:
mode:
authorPaul Varner <fuzzyray@gentoo.org>2010-12-28 18:30:14 -0600
committerPaul Varner <fuzzyray@gentoo.org>2010-12-28 18:30:14 -0600
commit879cf3ce1f3041854c9dc886b59ac7e136ae9b9b (patch)
tree7faa716b853d76a4c430d7b43024d82222d329e7 /bin/equery
parent258a81471b4106f12bafee2e5c0a5458e2db2280 (diff)
parenta9ac560d5f3e056d14146d5033e5637bbc9f68ef (diff)
downloadgentoolkit-879cf3ce1f3041854c9dc886b59ac7e136ae9b9b.tar.gz
Merge branch 'gentoolkit' into euse
Conflicts: bin/euse
Diffstat (limited to 'bin/equery')
-rwxr-xr-xbin/equery28
1 files changed, 22 insertions, 6 deletions
diff --git a/bin/equery b/bin/equery
index bac8a3a..54c3a07 100755
--- a/bin/equery
+++ b/bin/equery
@@ -2,12 +2,17 @@
#
# Copyright 2002-2009 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2 or later
+#
+# $Header$
-"""equery is a flexible utility for Gentoo linux which can display various
-information about packages, such as the files they own, their USE flags,
+"""equery is a flexible utility for Gentoo linux which can display various
+information about packages, such as the files they own, their USE flags,
the MD5 sum of each file owned by a given package, and many other things.
"""
+from __future__ import print_function
+
+import os
import sys
# This block ensures that ^C interrupts are handled quietly.
try:
@@ -16,7 +21,7 @@ try:
def exithandler(signum,frame):
signal.signal(signal.SIGINT, signal.SIG_IGN)
signal.signal(signal.SIGTERM, signal.SIG_IGN)
- print
+ print()
sys.exit(1)
signal.signal(signal.SIGINT, exithandler)
@@ -24,9 +29,20 @@ try:
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
except KeyboardInterrupt:
- print
+ print()
sys.exit(1)
-from gentoolkit import equery
+from gentoolkit import equery, errors
-equery.main()
+try:
+ equery.main()
+except errors.GentoolkitException as err:
+ if '--debug' in sys.argv or bool(os.getenv('DEBUG', False)):
+ raise
+ else:
+ from gentoolkit import pprinter as pp
+ sys.stderr.write(pp.error(str(err)))
+ if err.is_serious:
+ print()
+ print("Add '--debug' to global options for traceback.")
+ sys.exit(1)