3 # Copyright 2002-2009 Gentoo Technologies, Inc.
4 # Distributed under the terms of the GNU General Public License v2 or later
8 """equery is a flexible utility for Gentoo linux which can display various
9 information about packages, such as the files they own, their USE flags,
10 the MD5 sum of each file owned by a given package, and many other things.
13 from __future__ import print_function
17 # This block ensures that ^C interrupts are handled quietly.
21 def exithandler(signum,frame):
22 signal.signal(signal.SIGINT, signal.SIG_IGN)
23 signal.signal(signal.SIGTERM, signal.SIG_IGN)
27 signal.signal(signal.SIGINT, exithandler)
28 signal.signal(signal.SIGTERM, exithandler)
29 signal.signal(signal.SIGPIPE, signal.SIG_DFL)
31 except KeyboardInterrupt:
35 from gentoolkit import equery, errors
39 except errors.GentoolkitException as err:
40 if '--debug' in sys.argv or bool(os.getenv('DEBUG', False)):
43 from gentoolkit import pprinter as pp
44 sys.stderr.write(pp.error(str(err)))
47 print("Add '--debug' to global options for traceback.")