aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Dolbec <brian.dolbec@gmail.com>2011-01-16 22:46:38 -0800
committerBrian Dolbec <brian.dolbec@gmail.com>2011-01-16 22:46:38 -0800
commit86fb7c561cc6b10b473731c966a7ae4097df0f3d (patch)
treeea0df1aa78594de500fe6ae7e64f8fcbe8bb2df3
parentadd optional repo list limiter to the list function (diff)
downloadoverlord-86fb7c561cc6b10b473731c966a7ae4097df0f3d.tar.gz
overlord-86fb7c561cc6b10b473731c966a7ae4097df0f3d.tar.bz2
overlord-86fb7c561cc6b10b473731c966a7ae4097df0f3d.zip
Move color codes to a new file.
Add some message string constants
-rw-r--r--layman/constants.py45
-rw-r--r--layman/debug.py22
2 files changed, 53 insertions, 14 deletions
diff --git a/layman/constants.py b/layman/constants.py
new file mode 100644
index 0000000..7fc72ea
--- /dev/null
+++ b/layman/constants.py
@@ -0,0 +1,45 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#################################################################################
+# LAYMAN CONSTANTS
+#################################################################################
+# File: constants.py
+#
+# Handles layman actions via the command line interface.
+#
+# Copyright:
+# (c) 2010 - 2011
+# Gunnar Wrobel
+# Brian Dolbec
+# Distributed under the terms of the GNU General Public License v2
+#
+# Author(s):
+# Gunnar Wrobel <wrobel@gentoo.org>
+# Brian Dolbec <brian.dolbec@gmail.com
+#
+''' Provides the command line actions that can be performed by layman.'''
+
+__version__ = "$Id: constants.py 2011-01-16 23:52 PST Brian Dolbec$"
+
+
+
+
+#################################################################################
+##
+## Color codes (taken from portage)
+##
+#################################################################################
+
+esc_seq = '\x1b['
+
+codes = {}
+codes['reset'] = esc_seq + '39;49;00m'
+codes['red'] = esc_seq + '31;01m'
+codes['green'] = esc_seq + '32;01m'
+codes['yellow'] = esc_seq + '33;01m'
+codes['turquoise'] = esc_seq + '36;01m'
+
+
+NOT_OFFICIAL_MSG = '*** This is not an official gentoo overlay ***\n'
+NOT_SUPPORTED_MSG = '*** You are lacking the necessary tools' +\
+ ' to install this overlay ***\n'
diff --git a/layman/debug.py b/layman/debug.py
index e5a5d61..7c42974 100644
--- a/layman/debug.py
+++ b/layman/debug.py
@@ -18,20 +18,8 @@ import sys, inspect, types
from optparse import OptionGroup
-#################################################################################
-##
-## Color codes (taken from portage)
-##
-#################################################################################
+from layman.constants import codes
-esc_seq = '\x1b['
-
-codes = {}
-codes['reset'] = esc_seq + '39;49;00m'
-codes['red'] = esc_seq + '31;01m'
-codes['green'] = esc_seq + '32;01m'
-codes['yellow'] = esc_seq + '33;01m'
-codes['turquoise'] = esc_seq + '36;01m'
#################################################################################
##
@@ -112,6 +100,8 @@ class Message:
def cli_opts(self, parser):
+ #print "Parsing debug opts"
+
group = OptionGroup(parser,
'<Debugging options>',
'Control the debugging features of '
@@ -307,6 +297,8 @@ class Message:
def info (self, info, level = 4):
+ #print "info =", info
+
if type(info) not in types.StringTypes:
info = str(info)
@@ -346,6 +338,8 @@ class Message:
def warn (self, warn, level = 4):
+ #print "DEBUG.warn()"
+
if type(warn) not in types.StringTypes:
warn = str(warn)
@@ -453,7 +447,7 @@ class Message:
## Remove printed characters from output
x = x[60:]
## Print final line
- print >> self.debug_out, ls + '// ' + x
+ print >> self.debug_out, ls + '// ' + x
if self.debug_vrb == 1:
# Top line indicates class and method