Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   EPEL Development (http://www.linux-archive.org/epel-development/)
-   -   Get rid of using 'warnings' module. We can use logging directly. (http://www.linux-archive.org/epel-development/568157-get-rid-using-warnings-module-we-can-use-logging-directly.html)

Ales Kozumplik 08-25-2011 02:04 PM

Get rid of using 'warnings' module. We can use logging directly.
 
---
anaconda | 6 ------
pyanaconda/isys/__init__.py | 1 -
pyanaconda/kickstart.py | 3 +--
pyanaconda/yuminstall.py | 1 -
4 files changed, 1 insertions(+), 10 deletions(-)

diff --git a/anaconda b/anaconda
index 6ca3391..676b033 100755
--- a/anaconda
+++ b/anaconda
@@ -37,10 +37,6 @@ from tempfile import mkstemp
# keep up with process ID of the window manager if we start it
wm_pid = None

-# Make sure messages sent through python's warnings module get logged.
-def AnacondaShowWarning(message, category, filename, lineno, file=sys.stderr, line=None):
- log.warning("%s" % warnings.formatwarning(message, category, filename, lineno, line))
-
def startMetacityWM():
childpid = os.fork()
if not childpid:
@@ -575,7 +571,6 @@ if __name__ == "__main__":
isys.initLog()

import signal, string, time
- import warnings

from pyanaconda import iutil
from pyanaconda import vnc
@@ -586,7 +581,6 @@ if __name__ == "__main__":

from pyanaconda import Anaconda
anaconda = Anaconda()
- warnings.showwarning = AnacondaShowWarning
iutil.setup_translations(gettext)

# reset python's default SIGINT handler
diff --git a/pyanaconda/isys/__init__.py b/pyanaconda/isys/__init__.py
index 13026c7..fc766fc 100755
--- a/pyanaconda/isys/__init__.py
+++ b/pyanaconda/isys/__init__.py
@@ -37,7 +37,6 @@ import stat
import posix
import sys
from pyanaconda import iutil
-import warnings
import resource
import re
import struct
diff --git a/pyanaconda/kickstart.py b/pyanaconda/kickstart.py
index 7ec12b1..c38606d 100644
--- a/pyanaconda/kickstart.py
+++ b/pyanaconda/kickstart.py
@@ -40,7 +40,6 @@ from constants import *
import sys
import string
import urlgrabber
-import warnings
import network
import upgrade
import pykickstart.commands as commands
@@ -1508,7 +1507,7 @@ def setSteps(anaconda):

# Special check for this, since it doesn't make any sense.
if packagesSeen:
- warnings.warn("Ignoring contents of %packages section due to upgrade.")
+ log.warning("Ignoring contents of %packages section due to upgrade.")
elif havePackages(ksdata.packages):
dispatch.skip_steps("tasksel", "group-selection")
else:
diff --git a/pyanaconda/yuminstall.py b/pyanaconda/yuminstall.py
index da10e97..69275ee 100644
--- a/pyanaconda/yuminstall.py
+++ b/pyanaconda/yuminstall.py
@@ -26,7 +26,6 @@ import os
import os.path
import shutil
import time
-import warnings
import types
import locale
import glob
--
1.7.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 08:39 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.