[yum-cvs] 2 commits - rpmUtils/__init__.py yum/Errors.py yum/logginglevels.py yum/update_md.py

James Bowes jbowes at linux.duke.edu
Wed Dec 5 15:19:32 UTC 2007


 rpmUtils/__init__.py |    7 ++++---
 yum/Errors.py        |    8 ++------
 yum/logginglevels.py |    5 ++---
 yum/update_md.py     |    3 +--
 4 files changed, 9 insertions(+), 14 deletions(-)

New commits:
commit b35eeabbd681708f8549298fedd404497ce10c18
Author: James Bowes <jbowes at redhat.com>
Date:   Tue Dec 4 09:32:15 2007 -0500

    Move syslog definition to the top level to silence static code checkers.

diff --git a/yum/logginglevels.py b/yum/logginglevels.py
index 752eddc..b57a7cd 100644
--- a/yum/logginglevels.py
+++ b/yum/logginglevels.py
@@ -45,6 +45,8 @@ logging.addLevelName(DEBUG_4, "DEBUG_4")
 __NO_LOGGING = 100
 logging.raiseExceptions = False
 
+syslog = None
+
 def logLevelFromErrorLevel(error_level):
     """ Convert an old-style error logging level to the new style. """
     error_table = { -1 : __NO_LOGGING, 0 : logging.CRITICAL, 1 : logging.ERROR,
@@ -117,7 +119,6 @@ def doLoggingSetup(debuglevel, errorlevel):
 
     log_dev = '/dev/log'
     global syslog
-    syslog = None
     if os.path.exists(log_dev):
         try:
             syslog = logging.handlers.SysLogHandler(log_dev)
@@ -148,8 +149,6 @@ def setFileLog(uid, logfile):
             logging.getLogger("yum").critical('Cannot open logfile %s', logfile)
 
 def setLoggingApp(app):
-    global syslog
     if syslog:
         syslogformatter = logging.Formatter("yum(%s): "% (app,) + "%(message)s")
         syslog.setFormatter(syslogformatter)
-                    
commit c6e7d0d6ad0c94b8c34fac0d85d430b8b4ec5d29
Author: James Bowes <jbowes at redhat.com>
Date:   Tue Dec 4 09:27:14 2007 -0500

    Use the builtin Exception rather than importing exceptions.Exception

diff --git a/rpmUtils/__init__.py b/rpmUtils/__init__.py
index a0c7981..4b35611 100644
--- a/rpmUtils/__init__.py
+++ b/rpmUtils/__init__.py
@@ -1,9 +1,10 @@
 #!/usr/bin/python -tt
 
-import exceptions
 
+class RpmUtilsError(Exception):
+
+    """ Exception thrown for anything rpmUtils related. """
 
-class RpmUtilsError(exceptions.Exception):
     def __init__(self, args=None):
-        exceptions.Exception.__init__(self)
+        Exception.__init__(self)
         self.args = args
diff --git a/yum/Errors.py b/yum/Errors.py
index f5bf230..67f6495 100644
--- a/yum/Errors.py
+++ b/yum/Errors.py
@@ -15,13 +15,9 @@
 # Copyright 2004 Duke University
 
 
-
-import exceptions
-
-
-class YumBaseError(exceptions.Exception):
+class YumBaseError(Exception):
     def __init__(self, value=None):
-        exceptions.Exception.__init__(self)    
+        Exception.__init__(self)
         self.value = value
     def __str__(self):
         return "%s" %(self.value,)
diff --git a/yum/update_md.py b/yum/update_md.py
index 05d8197..b5fdeda 100644
--- a/yum/update_md.py
+++ b/yum/update_md.py
@@ -23,7 +23,6 @@ Update metadata (updateinfo.xml) parsing.
 
 import sys
 import gzip
-import exceptions
 
 from textwrap import wrap
 from yum.yumRepo import YumRepository
@@ -35,7 +34,7 @@ except ImportError:
 iterparse = cElementTree.iterparse
 
 
-class UpdateNoticeException(exceptions.Exception):
+class UpdateNoticeException(Exception):
     """ An exception thrown for bad UpdateNotice data. """
     pass
 



More information about the Yum-cvs-commits mailing list