public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Devan Franchini" <twitch153@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/layman:gsoc2014 commit in: layman/
Date: Wed, 14 May 2014 23:49:51 +0000 (UTC)	[thread overview]
Message-ID: <1400111035.b1139ac8a94f20dac366d0e8bdb66e747d6e14c6.twitch153@gentoo> (raw)

commit:     b1139ac8a94f20dac366d0e8bdb66e747d6e14c6
Author:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
AuthorDate: Wed May  7 22:17:23 2014 +0000
Commit:     Devan Franchini <twitch153 <AT> gentoo <DOT> org>
CommitDate: Wed May 14 23:43:55 2014 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/layman.git;a=commit;h=b1139ac8

{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
 
 


             reply	other threads:[~2014-05-14 23:49 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 23:49 Devan Franchini [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-08-15 23:59 [gentoo-commits] proj/layman:master commit in: layman/ Devan Franchini
2014-08-16  0:00 ` [gentoo-commits] proj/layman:gsoc2014 " Devan Franchini
2014-08-15 22:32 Devan Franchini
2014-08-15 22:32 Devan Franchini
2014-08-15 22:32 Devan Franchini
2014-08-15 22:32 Devan Franchini
2014-06-27  4:07 Devan Franchini
2014-06-27  4:07 Devan Franchini
2014-06-27  4:07 Devan Franchini
2014-06-16  3:40 [gentoo-commits] proj/layman:master " Brian Dolbec
2014-06-16  3:37 ` [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec
2014-06-16  3:40 [gentoo-commits] proj/layman:master " Brian Dolbec
2014-06-16  3:37 ` [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec
2014-06-16  3:40 [gentoo-commits] proj/layman:master " Brian Dolbec
2014-06-16  3:37 ` [gentoo-commits] proj/layman:gsoc2014 " Brian Dolbec
2014-06-16  3:37 Brian Dolbec
2014-06-16  3:37 Brian Dolbec
2014-06-16  3:37 Brian Dolbec
2014-06-16  3:37 Brian Dolbec
2014-05-16  2:30 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  1:07 Devan Franchini
2014-05-16  0:58 Devan Franchini
2014-05-16  0:58 Devan Franchini
2014-05-16  0:57 Devan Franchini
2014-05-15 20:46 Devan Franchini
2014-05-15 20:46 Devan Franchini
2014-05-15 20:37 Devan Franchini
2014-05-15 20:30 Devan Franchini
2014-05-15 20:02 Devan Franchini
2014-05-15  0:04 Devan Franchini
2014-05-14 23:54 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 23:49 Devan Franchini
2014-05-14 22:16 Devan Franchini
2014-05-14 22:08 Devan Franchini
2014-05-14 21:42 Devan Franchini
2014-05-14 21:30 Devan Franchini
2014-05-14 21:15 Devan Franchini
2014-05-14 21:15 Devan Franchini
2014-05-14 19:29 Devan Franchini
2014-05-14 18:55 Devan Franchini
2014-05-14 18:44 Devan Franchini
2014-05-14 17:32 Devan Franchini
2014-05-14  3:21 Devan Franchini
2014-05-14  0:37 Devan Franchini
2014-05-07 22:21 Devan Franchini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1400111035.b1139ac8a94f20dac366d0e8bdb66e747d6e14c6.twitch153@gentoo \
    --to=twitch153@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox