From b81133a92aa673d0d9315e9837012e59a988333a Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Sun, 21 Jun 2009 14:05:49 +0200 Subject: python: Add DeprecationWarning to functions which were replaced by classes. --- python/acquire.cc | 5 +++++ python/apt_pkgmodule.cc | 2 ++ python/cache.cc | 2 ++ python/cdrom.cc | 2 ++ python/depcache.cc | 8 ++++++++ python/pkgmanager.cc | 3 +++ python/pkgrecords.cc | 3 +++ python/pkgsrcrecords.cc | 11 +++-------- python/sourcelist.cc | 3 +++ python/tag.cc | 6 ++++++ 10 files changed, 37 insertions(+), 8 deletions(-) (limited to 'python') diff --git a/python/acquire.cc b/python/acquire.cc index 6b091479..d0549fd9 100644 --- a/python/acquire.cc +++ b/python/acquire.cc @@ -301,6 +301,8 @@ PyTypeObject PkgAcquireType = #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); return PkgAcquireNew(&PkgAcquireType,Args,0); } #endif @@ -394,6 +396,9 @@ 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); PyObject *pyfetcher; char *uri, *md5, *descr, *shortDescr, *destDir, *destFile; int size = 0; diff --git a/python/apt_pkgmodule.cc b/python/apt_pkgmodule.cc index bfa59f8e..3a31440c 100644 --- a/python/apt_pkgmodule.cc +++ b/python/apt_pkgmodule.cc @@ -34,6 +34,8 @@ 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); return CppPyObject_NEW(&ConfigurationType); } #endif diff --git a/python/cache.cc b/python/cache.cc index 35c8b78f..a8da6696 100644 --- a/python/cache.cc +++ b/python/cache.cc @@ -1371,6 +1371,8 @@ PyTypeObject RDepListType = #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); return PkgCacheNew(&PkgCacheType,Args,0); } #endif diff --git a/python/cdrom.cc b/python/cdrom.cc index e98947d1..e2651670 100644 --- a/python/cdrom.cc +++ b/python/cdrom.cc @@ -133,6 +133,8 @@ PyTypeObject PkgCdromType = #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); return PkgCdromNew(&PkgCdromType,Args,0); } #endif diff --git a/python/depcache.cc b/python/depcache.cc index 288eb0b0..7cf8e0a2 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -701,6 +701,8 @@ PyTypeObject PkgDepCacheType = #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); return PkgDepCacheNew(&PkgDepCacheType,Args,0); } #endif @@ -733,6 +735,9 @@ 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); return PkgProblemResolverNew(&PkgProblemResolverType,Args,0); } #endif @@ -1003,6 +1008,9 @@ PyTypeObject PkgActionGroupType = #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); return PkgActionGroupNew(&PkgActionGroupType,Args,0); } #endif diff --git a/python/pkgmanager.cc b/python/pkgmanager.cc index 0fd2cd92..668f7cfc 100644 --- a/python/pkgmanager.cc +++ b/python/pkgmanager.cc @@ -39,6 +39,9 @@ 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); return PkgManagerNew(&PkgManagerType,Args,0); } #endif diff --git a/python/pkgrecords.cc b/python/pkgrecords.cc index 8beefffd..1e36259d 100644 --- a/python/pkgrecords.cc +++ b/python/pkgrecords.cc @@ -214,6 +214,9 @@ PyTypeObject PkgRecordsType = #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); return PkgRecordsNew(&PkgRecordsType,Args,0); } #endif diff --git a/python/pkgsrcrecords.cc b/python/pkgsrcrecords.cc index e6b78a83..f75934f9 100644 --- a/python/pkgsrcrecords.cc +++ b/python/pkgsrcrecords.cc @@ -255,14 +255,9 @@ PyTypeObject PkgSrcRecordsType = #ifdef COMPAT_0_7 PyObject *GetPkgSrcRecords(PyObject *Self,PyObject *Args) { -#if 0 - PyObject *Owner; - if (PyArg_ParseTuple(Args,"O!",&PkgCacheType,&Owner) == 0) - return 0; - - return HandleErrors(CppOwnedPyObject_NEW(Owner, - &PkgSrcRecordsType)); -#endif + 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 e53fccd3..2cf5eea9 100644 --- a/python/sourcelist.cc +++ b/python/sourcelist.cc @@ -163,6 +163,9 @@ PyTypeObject PkgSourceListType = #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); return PkgSourceListNew(&PkgSourceListType,Args,0); } #endif diff --git a/python/tag.cc b/python/tag.cc index 7e7eb21c..05423e3d 100644 --- a/python/tag.cc +++ b/python/tag.cc @@ -268,6 +268,9 @@ 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); return TagSecNew(&TagSecType,Args,0); } #endif @@ -302,6 +305,9 @@ 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); return TagFileNew(&TagFileType,Args,0); } #endif -- cgit v1.2.3