[dak/master] Suppress warnings in the most suitable files.
Signed-off-by: Torsten Werner <twerner@debian.org>
---
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 fb00210..a25afb6 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 5b247f0..0e1b34f 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 28ecd7b..fac1692 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 3a8d15e..d1f78f3 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 b35ed9a..9993ec3 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 227a8af..72453f6 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 dc606cc..a281f3d 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 d95f0cb..d7f906c 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 fd67d5b..0e47d57 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"
--
1.5.6.5
Reply to: