From 4b74ecd4df220fcb9939445a9774bbcf6ba3212e Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Mon, 29 Mar 2010 13:20:52 +0200 Subject: If PYTHON_APT_DEPRECATION_WARNINGS is unset, also disable the deprecation warnings in apt_pkg directly; and don't just disable any deprecation warning in apt/__init__.py (LP: #548623) --- python/cdrom.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'python/cdrom.cc') diff --git a/python/cdrom.cc b/python/cdrom.cc index 9eae49dc..d732a810 100644 --- a/python/cdrom.cc +++ b/python/cdrom.cc @@ -78,9 +78,10 @@ static PyObject *cdrom_ident(PyObject *Self,PyObject *Args) #ifdef COMPAT_0_7 static PyObject *cdrom_ident_old(PyObject *Self,PyObject *Args) { - PyErr_WarnEx(PyExc_DeprecationWarning, "Method 'Ident' of the " - "'apt_pkg.Cdrom' object is deprecated, use 'ident' instead.", - 1); + if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL) + PyErr_WarnEx(PyExc_DeprecationWarning, "Method 'Ident' of the " + "'apt_pkg.Cdrom' object is deprecated, use 'ident' instead.", + 1); pkgCdrom &Cdrom = GetCpp(Self); PyObject *pyCdromProgressInst = 0; @@ -164,8 +165,9 @@ PyTypeObject PyCdrom_Type = { #ifdef COMPAT_0_7 PyObject *GetCdrom(PyObject *Self,PyObject *Args) { - PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetCdrom() is deprecated. " - "Please see apt_pkg.Cdrom() for the replacement.", 1); + if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL) + PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetCdrom() is deprecated. " + "Please see apt_pkg.Cdrom() for the replacement.", 1); return cdrom_new(&PyCdrom_Type,Args,0); } #endif -- cgit v1.2.3