summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2010-03-29 13:20:52 +0200
committerJulian Andres Klode <jak@debian.org>2010-03-29 13:20:52 +0200
commit4b74ecd4df220fcb9939445a9774bbcf6ba3212e (patch)
treefe24df1f2b3c5c1fd3dd4dc171bbfd5d2f8bc694 /python
parent4f1a8ff1fcd780c2d42dbc59f41ca38581e6f10c (diff)
downloadpython-apt-4b74ecd4df220fcb9939445a9774bbcf6ba3212e.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')
-rw-r--r--python/acquire-item.cc7
-rw-r--r--python/acquire.cc5
-rw-r--r--python/apt_pkgmodule.cc5
-rw-r--r--python/cache.cc17
-rw-r--r--python/cdrom.cc12
-rw-r--r--python/depcache.cc19
-rw-r--r--python/generic.cc3
-rw-r--r--python/generic.h1
-rw-r--r--python/pkgmanager.cc7
-rw-r--r--python/pkgrecords.cc7
-rw-r--r--python/pkgsrcrecords.cc7
-rw-r--r--python/sourcelist.cc7
-rw-r--r--python/tag.cc14
13 files changed, 65 insertions, 46 deletions
diff --git a/python/acquire-item.cc b/python/acquire-item.cc
index cdb4a4bc..cb41f489 100644
--- a/python/acquire-item.cc
+++ b/python/acquire-item.cc
@@ -279,9 +279,10 @@ char *doc_GetPkgAcqFile =
"GetPkgAcqFile(pkgAquire, uri[, md5, size, descr, shortDescr, destDir, destFile]) -> PkgAcqFile\n";
PyObject *GetPkgAcqFile(PyObject *Self, PyObject *Args, PyObject * kwds)
{
- PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgAcqFile() is "
- "deprecated. Please see apt_pkg.AcquireFile() for the "
- "replacement", 1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgAcqFile() is "
+ "deprecated. Please see apt_pkg.AcquireFile() for the "
+ "replacement", 1);
PyObject *pyfetcher;
char *uri, *md5, *descr, *shortDescr, *destDir, *destFile;
int size = 0;
diff --git a/python/acquire.cc b/python/acquire.cc
index cc9ee310..3f24a3e7 100644
--- a/python/acquire.cc
+++ b/python/acquire.cc
@@ -372,8 +372,9 @@ PyTypeObject PyAcquire_Type = {
#ifdef COMPAT_0_7
PyObject *GetAcquire(PyObject *Self,PyObject *Args)
{
- PyErr_WarnEx(PyExc_DeprecationWarning,"apt_pkg.GetAcquire() is deprecated."
- " Please see apt_pkg.Acquire() for the replacement.", 1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning,"apt_pkg.GetAcquire() is deprecated."
+ " Please see apt_pkg.Acquire() for the replacement.", 1);
return PkgAcquireNew(&PyAcquire_Type,Args,0);
}
#endif
diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc
index 3d40832b..2a181619 100644
--- a/python/apt_pkgmodule.cc
+++ b/python/apt_pkgmodule.cc
@@ -54,8 +54,9 @@ static PyObject *py_gettext(PyObject *self, PyObject *Args) {
static char *doc_newConfiguration = "Construct a configuration instance";
static PyObject *newConfiguration(PyObject *self,PyObject *args)
{
- PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.newConfiguration() is "
- "deprecated. Use apt_pkg.Configuration() instead.", 1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.newConfiguration() is "
+ "deprecated. Use apt_pkg.Configuration() instead.", 1);
return CppPyObject_NEW<Configuration*>(NULL, &PyConfiguration_Type, new Configuration());
}
#endif
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
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<pkgCdrom>(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
diff --git a/python/depcache.cc b/python/depcache.cc
index 8b4e02b5..0d5d7882 100644
--- a/python/depcache.cc
+++ b/python/depcache.cc
@@ -694,8 +694,9 @@ PyTypeObject PyDepCache_Type =
#ifdef COMPAT_0_7
PyObject *GetDepCache(PyObject *Self,PyObject *Args)
{
- PyErr_WarnEx(PyExc_DeprecationWarning,"apt_pkg.GetDepCache() is deprecated"
- ". Please see apt_pkg.DepCache() for the replacement.",1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning,"apt_pkg.GetDepCache() is deprecated"
+ ". Please see apt_pkg.DepCache() for the replacement.",1);
return PkgDepCacheNew(&PyDepCache_Type,Args,0);
}
#endif
@@ -728,9 +729,10 @@ static PyObject *PkgProblemResolverNew(PyTypeObject *type,PyObject *Args,PyObjec
#ifdef COMPAT_0_7
PyObject *GetPkgProblemResolver(PyObject *Self,PyObject *Args) {
- PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgProblemResolver() is"
- " deprecated. Please see apt_pkg.ProblemResolver() for the "
- "replacement.", 1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgProblemResolver() is"
+ " deprecated. Please see apt_pkg.ProblemResolver() for the "
+ "replacement.", 1);
return PkgProblemResolverNew(&PyProblemResolver_Type,Args,0);
}
#endif
@@ -989,9 +991,10 @@ PyTypeObject PyActionGroup_Type =
#ifdef COMPAT_0_7
PyObject *GetPkgActionGroup(PyObject *Self,PyObject *Args)
{
- PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgActionGroup() is "
- "deprecated. Please see apt_pkg.ActionGroup() for the "
- "replacement.", 1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgActionGroup() is "
+ "deprecated. Please see apt_pkg.ActionGroup() for the "
+ "replacement.", 1);
return PkgActionGroupNew(&PyActionGroup_Type,Args,0);
}
#endif
diff --git a/python/generic.cc b/python/generic.cc
index f0980f2b..d08b12c0 100644
--- a/python/generic.cc
+++ b/python/generic.cc
@@ -101,7 +101,8 @@ PyObject *_PyAptObject_getattro(PyObject *self, PyObject *attr) {
strlen(attrname) + 66];
sprintf(warning_string, "Attribute '%s' of the '%s' object is "
"deprecated, use '%s' instead.", attrname, cls, newattrname);
- PyErr_WarnEx(PyExc_DeprecationWarning, warning_string, 1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning, warning_string, 1);
delete[] warning_string;
} else {
Py_XINCREF(ptype);
diff --git a/python/generic.h b/python/generic.h
index 31c1bc2d..98c6d82b 100644
--- a/python/generic.h
+++ b/python/generic.h
@@ -31,6 +31,7 @@
#include <string>
#include <iostream>
#include <new>
+#include <cstdlib>
#if PYTHON_API_VERSION < 1013
typedef int Py_ssize_t;
diff --git a/python/pkgmanager.cc b/python/pkgmanager.cc
index 2fda14ee..e8346b3d 100644
--- a/python/pkgmanager.cc
+++ b/python/pkgmanager.cc
@@ -39,9 +39,10 @@ static PyObject *PkgManagerNew(PyTypeObject *type,PyObject *Args,PyObject *kwds)
#ifdef COMPAT_0_7
PyObject *GetPkgManager(PyObject *Self,PyObject *Args)
{
- PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPackageManager() is "
- "deprecated. Please see apt_pkg.PackageManager() for the "
- "replacement.", 1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPackageManager() is "
+ "deprecated. Please see apt_pkg.PackageManager() for the "
+ "replacement.", 1);
return PkgManagerNew(&PyPackageManager_Type,Args,0);
}
#endif
diff --git a/python/pkgrecords.cc b/python/pkgrecords.cc
index 0e00edcd..916a2e0f 100644
--- a/python/pkgrecords.cc
+++ b/python/pkgrecords.cc
@@ -195,9 +195,10 @@ PyTypeObject PyPackageRecords_Type =
#ifdef COMPAT_0_7
PyObject *GetPkgRecords(PyObject *Self,PyObject *Args)
{
- PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgRecords() is "
- "deprecated. Please see apt_pkg.Records() for the "
- "replacement.", 1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgRecords() is "
+ "deprecated. Please see apt_pkg.Records() for the "
+ "replacement.", 1);
return PkgRecordsNew(&PyPackageRecords_Type,Args,0);
}
#endif
diff --git a/python/pkgsrcrecords.cc b/python/pkgsrcrecords.cc
index 95f35f23..729a74b5 100644
--- a/python/pkgsrcrecords.cc
+++ b/python/pkgsrcrecords.cc
@@ -292,9 +292,10 @@ PyTypeObject PySourceRecords_Type =
#ifdef COMPAT_0_7
PyObject *GetPkgSrcRecords(PyObject *Self,PyObject *Args)
{
- PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgSrcRecords() is "
- "deprecated. Please see apt_pkg.SourceRecords() for the "
- "replacement.", 1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgSrcRecords() is "
+ "deprecated. Please see apt_pkg.SourceRecords() for the "
+ "replacement.", 1);
if (PyArg_ParseTuple(Args,"") == 0)
return 0;
diff --git a/python/sourcelist.cc b/python/sourcelist.cc
index 6184fee3..5a950b2c 100644
--- a/python/sourcelist.cc
+++ b/python/sourcelist.cc
@@ -157,9 +157,10 @@ PyTypeObject PySourceList_Type =
#ifdef COMPAT_0_7
PyObject *GetPkgSourceList(PyObject *Self,PyObject *Args)
{
- PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgSourceList() is "
- "deprecated. Please see apt_pkg.SourceList() for the "
- "replacement.", 1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.GetPkgSourceList() is "
+ "deprecated. Please see apt_pkg.SourceList() for the "
+ "replacement.", 1);
return PkgSourceListNew(&PySourceList_Type,Args,0);
}
#endif
diff --git a/python/tag.cc b/python/tag.cc
index c7edcb31..bc470620 100644
--- a/python/tag.cc
+++ b/python/tag.cc
@@ -349,9 +349,10 @@ static PyObject *TagSecNew(PyTypeObject *type,PyObject *Args,PyObject *kwds) {
char *doc_ParseSection ="ParseSection(Text) -> TagSection() object. Deprecated.";
PyObject *ParseSection(PyObject *self,PyObject *Args)
{
- PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.ParseSection() is "
- "deprecated. Please see apt_pkg.TagSection() for the "
- "replacement.", 1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.ParseSection() is "
+ "deprecated. Please see apt_pkg.TagSection() for the "
+ "replacement.", 1);
return TagSecNew(&PyTagSection_Type,Args,0);
}
#endif
@@ -388,9 +389,10 @@ static PyObject *TagFileNew(PyTypeObject *type,PyObject *Args,PyObject *kwds)
#ifdef COMPAT_0_7
char *doc_ParseTagFile = "ParseTagFile(File) -> TagFile() object. Deprecated.";
PyObject *ParseTagFile(PyObject *self,PyObject *Args) {
- PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.ParseTagFile() is "
- "deprecated. Please see apt_pkg.TagFile() for the "
- "replacement.", 1);
+ if (getenv("PYTHON_APT_DEPRECATION_WARNINGS") != NULL)
+ PyErr_WarnEx(PyExc_DeprecationWarning, "apt_pkg.ParseTagFile() is "
+ "deprecated. Please see apt_pkg.TagFile() for the "
+ "replacement.", 1);
return TagFileNew(&PyTagFile_Type,Args,0);
}
#endif