From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 978371381FA for ; Wed, 7 May 2014 22:21:25 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 92431E09B3; Wed, 7 May 2014 22:21:24 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0E20CE09B3 for ; Wed, 7 May 2014 22:21:23 +0000 (UTC) Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id A007133FB3E for ; Wed, 7 May 2014 22:21:22 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by spoonbill.gentoo.org (Postfix) with ESMTP id 63F221818D for ; Wed, 7 May 2014 22:21:21 +0000 (UTC) From: "Devan Franchini" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Devan Franchini" Message-ID: <1399501265.c7e10325007dd6b86196f61ddb7a5adc3797127b.twitch153@gentoo> Subject: [gentoo-commits] proj/layman:gsoc2014 commit in: layman/ X-VCS-Repository: proj/layman X-VCS-Files: layman/config.py layman/constants.py layman/output.py X-VCS-Directories: layman/ X-VCS-Committer: twitch153 X-VCS-Committer-Name: Devan Franchini X-VCS-Revision: c7e10325007dd6b86196f61ddb7a5adc3797127b X-VCS-Branch: gsoc2014 Date: Wed, 7 May 2014 22:21:21 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: f8fafb83-c08e-4b19-872a-e822e5a7cdf8 X-Archives-Hash: f0c02002b758703eed34721ef522a464 commit: c7e10325007dd6b86196f61ddb7a5adc3797127b Author: Devan Franchini gentoo org> AuthorDate: Wed May 7 22:17:23 2014 +0000 Commit: Devan Franchini gentoo org> CommitDate: Wed May 7 22:21:05 2014 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=c7e10325 layman/{config, constants, output}.py: Adds notice level. The -q flag setting was being ignored by output.notice() calls. Adding note_level to the output.notice() function makes it so that the output will be quieted, if desired. X-Gentoo-Bug: 457726 X-Gentoo-Bug-URL: https://bugs.gentoo.org/457726 --- layman/config.py | 1 + layman/constants.py | 1 + layman/output.py | 19 ++++++++++++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/layman/config.py b/layman/config.py index 576ed05..bf33f50 100644 --- a/layman/config.py +++ b/layman/config.py @@ -228,6 +228,7 @@ class BareConfig(object): def _set_quietness(self, value): self._options['output'].set_info_level(value) self._options['output'].set_warn_level(value) + self._options['output'].set_note_level(value) def __getitem__(self, key): return self._get_(key) diff --git a/layman/constants.py b/layman/constants.py index 6f53de3..9a2af40 100644 --- a/layman/constants.py +++ b/layman/constants.py @@ -48,6 +48,7 @@ NOT_SUPPORTED_MSG = '*** You are lacking the necessary tools' +\ OFF = 0 WARN_LEVEL = 4 INFO_LEVEL = 4 +NOTE_LEVEL = 4 DEBUG_LEVEL = 4 DEBUG_VERBOSITY = 2 diff --git a/layman/output.py b/layman/output.py index b48531a..48b44a1 100644 --- a/layman/output.py +++ b/layman/output.py @@ -12,7 +12,7 @@ __version__ = "0.1" import sys -from layman.constants import codes, INFO_LEVEL, WARN_LEVEL, DEBUG_LEVEL, OFF +from layman.constants import codes, INFO_LEVEL, WARN_LEVEL, NOTE_LEVEL, DEBUG_LEVEL, OFF from layman.compatibility import encode @@ -25,6 +25,7 @@ class MessageBase(object): err = sys.stderr, info_level = INFO_LEVEL, warn_level = WARN_LEVEL, + note_level = NOTE_LEVEL, col = True, error_callback=None ): @@ -46,6 +47,9 @@ class MessageBase(object): # The higher the level the more information you will get self.info_lev = info_level + # The higher the level the more information you will get + self.note_lev = note_level + # Should the output be colored? self.color_func = None self.set_colorize(col) @@ -81,6 +85,10 @@ class MessageBase(object): self.warn_lev = warn_level + def set_note_level(self, note_level = NOTE_LEVEL): + self.note_lev = note_level + + def set_debug_level(self, debugging_level = DEBUG_LEVEL): self.debug_lev = debugging_level @@ -103,12 +111,13 @@ class Message(MessageBase): err = sys.stderr, info_level = INFO_LEVEL, warn_level = WARN_LEVEL, + note_level = NOTE_LEVEL, col = True, error_callback = None ): MessageBase.__init__(self, out, err, info_level, warn_level, - col, error_callback) + note_level, col, error_callback) ## Output Functions @@ -127,7 +136,11 @@ class Message(MessageBase): print >> self.std_out, self.color_func('yellow', 'DEBUG: ') + i - def notice (self, note): + def notice (self, note, level = NOTE_LEVEL): + + if level > self.note_lev: + return + print >> self.std_out, note