From 4830d9be143c7645ea932b53fae095e275ad7814 Mon Sep 17 00:00:00 2001 From: Torsten Werner Date: Sun, 16 Jan 2011 23:49:05 +0100 Subject: [PATCH] Suppress warnings in the most suitable files. Signed-off-by: Torsten Werner --- dak/dak.py | 5 ----- dak/examine_package.py | 6 ++++++ dak/show_deferred.py | 9 ++++++++- daklib/binary.py | 7 ++++++- daklib/config.py | 10 ++++++++++ daklib/dbconn.py | 10 ++++++++++ tests/base_test.py | 15 --------------- tests/db_test.py | 5 ----- tools/queue_rss.py | 7 ++++++- 9 files changed, 46 insertions(+), 28 deletions(-) diff --git a/dak/dak.py b/dak/dak.py index fb002102..a25afb66 100755 --- a/dak/dak.py +++ b/dak/dak.py @@ -37,7 +37,6 @@ import os import sys import traceback import daklib.utils -import warnings from daklib.daklog import Logger from daklib.config import Config @@ -209,10 +208,6 @@ def main(): daklib.utils.warn("unknown command '%s'" % (cmdname)) usage(functionality, 1) - # We do not care. No idea wth sqlalchemy warns about them, makes no sense, - # so we ignore it. - warnings.filterwarnings("ignore", 'Predicate of partial index') - # Invoke the module module = __import__(cmdname.replace("-","_")) diff --git a/dak/examine_package.py b/dak/examine_package.py index 5b247f0c..0e1b34ff 100755 --- a/dak/examine_package.py +++ b/dak/examine_package.py @@ -42,6 +42,12 @@ to stdout. Those functions can be used in multithreaded parts of dak. ################################################################################ +# suppress some deprecation warnings in squeeze related to md5 module +import warnings +warnings.filterwarnings('ignore', \ + "the md5 module is deprecated; use hashlib instead", \ + DeprecationWarning) + import errno import os import re diff --git a/dak/show_deferred.py b/dak/show_deferred.py index 28ecd7b6..fac16927 100755 --- a/dak/show_deferred.py +++ b/dak/show_deferred.py @@ -22,7 +22,14 @@ import sys, os, re, time import apt_pkg -from debian_bundle import deb822 + +try: + # starting with squeeze + from debian import deb822 +except: + # up to lenny + from debian_bundle import deb822 + from daklib.dbconn import * from daklib import utils from daklib.regexes import re_html_escaping, html_escaping diff --git a/daklib/binary.py b/daklib/binary.py index 3a8d15e2..d1f78f3a 100644 --- a/daklib/binary.py +++ b/daklib/binary.py @@ -47,7 +47,12 @@ import commands import traceback import atexit -from debian_bundle import deb822 +try: + # starting with squeeze + from debian import deb822 +except: + # up to lenny + from debian_bundle import deb822 from dbconn import * from config import Config diff --git a/daklib/config.py b/daklib/config.py index b35ed9a9..9993ec3a 100755 --- a/daklib/config.py +++ b/daklib/config.py @@ -36,6 +36,16 @@ import socket default_config = "/etc/dak/dak.conf" #: default dak config, defines host properties +# suppress some deprecation warnings in squeeze related to apt_pkg +# module +import warnings +warnings.filterwarnings('ignore', \ + "Attribute '.*' of the 'apt_pkg\.Configuration' object is deprecated, use '.*' instead\.", \ + DeprecationWarning) +warnings.filterwarnings('ignore', \ + "apt_pkg\.newConfiguration\(\) is deprecated\. Use apt_pkg\.Configuration\(\) instead\.", \ + DeprecationWarning) + def which_conf_file(): return os.getenv("DAK_CONFIG", default_config) diff --git a/daklib/dbconn.py b/daklib/dbconn.py index 227a8af1..72453f64 100755 --- a/daklib/dbconn.py +++ b/daklib/dbconn.py @@ -59,6 +59,16 @@ from config import Config from textutils import fix_maintainer from dak_exceptions import NoSourceFieldError +# suppress some deprecation warnings in squeeze related to sqlalchemy +import warnings +warnings.filterwarnings('ignore', \ + "The SQLAlchemy PostgreSQL dialect has been renamed from 'postgres' to 'postgresql'.*", \ + SADeprecationWarning) +# TODO: sqlalchemy needs some extra configuration to correctly reflect +# the ind_deb_contents_* indexes - we ignore the warnings at the moment +warnings.filterwarnings("ignore", 'Predicate of partial index', SAWarning) + + ################################################################################ # Patch in support for the debversion field type so that it works during diff --git a/tests/base_test.py b/tests/base_test.py index dc606cc7..a281f3d1 100644 --- a/tests/base_test.py +++ b/tests/base_test.py @@ -7,21 +7,6 @@ from os.path import abspath, dirname, join DAK_ROOT_DIR = dirname(dirname(abspath(__file__))) -# suppress some deprecation warnings in squeeze related to apt_pkg, -# debian, and md5 modules -warnings.filterwarnings('ignore', \ - "Attribute '.*' of the 'apt_pkg\.Configuration' object is deprecated, use '.*' instead\.", \ - DeprecationWarning) -warnings.filterwarnings('ignore', \ - "apt_pkg\.newConfiguration\(\) is deprecated\. Use apt_pkg\.Configuration\(\) instead\.", \ - DeprecationWarning) -warnings.filterwarnings('ignore', \ - "please use 'debian' instead of 'debian_bundle'", \ - DeprecationWarning) -warnings.filterwarnings('ignore', \ - "the md5 module is deprecated; use hashlib instead", \ - DeprecationWarning) - class DakTestCase(unittest.TestCase): def setUp(self): pass diff --git a/tests/db_test.py b/tests/db_test.py index d95f0cbf..d7f906cd 100644 --- a/tests/db_test.py +++ b/tests/db_test.py @@ -10,11 +10,6 @@ from sqlalchemy.schema import DDL import pickle import warnings -# suppress some deprecation warnings in squeeze related to sqlalchemy -warnings.filterwarnings('ignore', \ - "The SQLAlchemy PostgreSQL dialect has been renamed from 'postgres' to 'postgresql'.*", \ - SADeprecationWarning) - all_tables = ['architecture', 'archive', 'bin_associations', 'bin_contents', 'binaries', 'binary_acl', 'binary_acl_map', 'build_queue', 'build_queue_files', 'changes', 'changes_pending_binaries', 'changes_pending_files', diff --git a/tools/queue_rss.py b/tools/queue_rss.py index fd67d5bd..0e47d57b 100755 --- a/tools/queue_rss.py +++ b/tools/queue_rss.py @@ -17,7 +17,12 @@ from datetime import datetime import PyRSS2Gen -from debian_bundle.deb822 import Changes +try: + # starting with squeeze + from debian.deb822 import Changes +except: + # up to lenny + from debian_bundle.deb822 import Changes inrss_filename = "NEW_in.rss" outrss_filename = "NEW_out.rss" -- 2.39.5