summaryrefslogtreecommitdiff
path: root/python/cache.cc
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2010-03-29 14:22:11 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2010-03-29 14:22:11 +0200
commit82dc1170b0b29f7bb264d046d1c9253f4d97fb10 (patch)
treefe24df1f2b3c5c1fd3dd4dc171bbfd5d2f8bc694 /python/cache.cc
parent4f1a8ff1fcd780c2d42dbc59f41ca38581e6f10c (diff)
parent4b74ecd4df220fcb9939445a9774bbcf6ba3212e (diff)
downloadpython-apt-82dc1170b0b29f7bb264d046d1c9253f4d97fb10.tar.gz
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)
Diffstat (limited to 'python/cache.cc')
-rw-r--r--python/cache.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/python/cache.cc b/python/cache.cc
index 3c9bc785..ba620099 100644
--- a/python/cache.cc
+++ b/python/cache.cc
@@ -105,8 +105,9 @@ static PyObject *PkgCacheUpdate(PyObject *Self,PyObject *Args)
#ifdef COMPAT_0_7
static PyObject *PkgCacheClose(PyObject *Self,PyObject *Args)
{
- PyErr_WarnEx(PyExc_DeprecationWarning, "Cache.Close() is deprecated, "
- "because it causes segfaults. Delete the Cache instead.", 1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning, "Cache.Close() is deprecated, "
+ "because it causes segfaults. Delete the Cache instead.", 1);
PyObject *CacheFilePy = GetOwner<pkgCache*>(Self);
pkgCacheFile *Cache = GetCpp<pkgCacheFile*>(CacheFilePy);
Cache->Close();
@@ -117,9 +118,10 @@ static PyObject *PkgCacheClose(PyObject *Self,PyObject *Args)
static PyObject *PkgCacheOpen(PyObject *Self,PyObject *Args)
{
- PyErr_WarnEx(PyExc_DeprecationWarning, "Cache.Open() is deprecated, "
- "because it causes memory leaks. Create a new Cache instead.",
- 1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning, "Cache.Open() is deprecated, "
+ "because it causes memory leaks. Create a new Cache instead.",
+ 1);
PyObject *CacheFilePy = GetOwner<pkgCache*>(Self);
pkgCacheFile *Cache = GetCpp<pkgCacheFile*>(CacheFilePy);
@@ -1296,8 +1298,9 @@ PyTypeObject PyDependencyList_Type =
#ifdef COMPAT_0_7
PyObject *TmpGetCache(PyObject *Self,PyObject *Args)
{
- PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetCache() is deprecated. "
- "Please see apt_pkg.Cache() for the replacement.", 1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetCache() is deprecated. "
+ "Please see apt_pkg.Cache() for the replacement.", 1);
return PkgCacheNew(&PyCache_Type,Args,0);
}
#endif