diff options
author | Corentin Chary <corentincj@iksaif.net> | 2011-12-11 14:32:38 +0100 |
---|---|---|
committer | Corentin Chary <corentincj@iksaif.net> | 2011-12-11 14:32:38 +0100 |
commit | 3569f1bb975cf7e4f9b4464d5ed76169e74dc4ed (patch) | |
tree | 070a7df37eddbf53481b554dde5990def3c7e73d /bin | |
parent | euscan: 0.1.0 (diff) | |
download | euscan-3569f1bb975cf7e4f9b4464d5ed76169e74dc4ed.tar.gz euscan-3569f1bb975cf7e4f9b4464d5ed76169e74dc4ed.tar.bz2 euscan-3569f1bb975cf7e4f9b4464d5ed76169e74dc4ed.zip |
euscan: better --quiet mode
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/euscan | 42 |
1 files changed, 24 insertions, 18 deletions
@@ -29,7 +29,8 @@ from gentoolkit import pprinter as pp from gentoolkit.eclean.search import (port_settings) from gentoolkit.errors import GentoolkitException -from euscan import CONFIG, output +import euscan +from euscan import CONFIG from euscan.scan import scan_upstream """ Globals """ @@ -198,7 +199,7 @@ def main(): sys.exit(errno.EINVAL) """ Change euscan's output """ - output = EOutput(CONFIG['quiet']) + euscan.output = EOutput(CONFIG['quiet']) if CONFIG['verbose'] > 2: httplib.HTTPConnection.debuglevel = 1 @@ -208,29 +209,34 @@ def main(): try: ret = scan_upstream(package) except AmbiguousPackageName as e: - pkgs = e.args[0] - for candidate in pkgs: - print(candidate) + pkgs = e.args[0] + for candidate in pkgs: + print(candidate) - from os.path import basename # To get the short name + from os.path import basename # To get the short name - print(file=sys.stderr) - print(pp.error("The short ebuild name '%s' is ambiguous. Please specify" % basename(pkgs[0])), - file=sys.stderr, end="") - pp.die(1, "one of the above fully-qualified ebuild names instead.") + print(file=sys.stderr) + print(pp.error("The short ebuild name '%s' is ambiguous. Please specify" % basename(pkgs[0])), + file=sys.stderr, end="") + pp.die(1, "one of the above fully-qualified ebuild names instead.") except GentoolkitException as err: - pp.die(1, str(err)) + pp.die(1, str(err)) except Exception as err: - pp.die(1, str(err)) + pp.die(1, str(err)) - print () + if not CONFIG['quiet']: + print () - for url, version in ret: - print ("Upstream Version: " - + pp.number("%s" % version) - + pp.path(" %s" % url)) + for cp, url, version in ret: + if not CONFIG['quiet']: + print ("Upstream Version: " + + pp.number("%s" % version) + + pp.path(" %s" % url)) + else: + print (pp.cpv("%s-%s" % (cp, version)) + + ": " + pp.path(url)) - if not len(ret): + if not len(ret) and not CONFIG['quiet']: print (pp.warn("Didn't find any new version, " + "check package's homepage for " + "more informations")); |