diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2005-05-03 16:25:44 +0000 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2005-05-03 16:25:44 +0000 |
| commit | 52ecc81517a1fa9748d04f0c0d05ce8396233b71 (patch) | |
| tree | c8957577c5016af06dcd5c130f01834d69f27f2b /python | |
| parent | 5483ca175e5aa2b7de55cb0cea69546d2ccd2cd5 (diff) | |
| download | python-apt-52ecc81517a1fa9748d04f0c0d05ce8396233b71.tar.gz | |
* merged with Greek0@gmx.net--2005-main, native apt interface added, fixed a refcount problem, added tests/ directory
* apt/package.py, apt/__init__.py:
- started a native python interface that will wrap the uglier
bits of python-apt in the future
* tests/pkgsrcrecords.py:
- started a test directory
* python/pkgsrcrecords.cc:
- fixed a refcount problem
- merged with Greek0s tree
Patches applied:
* Greek0@gmx.net--2005-main/python-apt--debian--0.6--base-0
tag of apt@packages.debian.org/python-apt--main--0--patch-8
* Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-1
Minor typo fix in debian/rules
* Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-2
Typo fix in depcache.cc which caused wrong function to be called
* Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-3
Improved CppPyObject, leading to a better PkgDepCacheStruct
* Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-4
Improved build system
* Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-5
Restored the old tar.cc to work with the older apt in debian again
* Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-6
Fix for Debian #304296 (Segfault in CppOwnedDealloc)
* Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-7
Fix for Debian #304903 (FD leak)
* Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-8
Fixed the compilation error introduced in patch-6
* Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-9
New debian/changelog from Debians python-apt 0.6.10
* Greek0@gmx.net--2005-main/python-apt--debian--0.6--patch-10
Minor changes to make the packages lintian/linda clean
* apt@packages.debian.org/python-apt--main--0--patch-8
Merge michael.vogt@ubuntu.com--2005/python-apt--pkgDepCache--0
Diffstat (limited to 'python')
| -rw-r--r-- | python/depcache.cc | 6 | ||||
| -rw-r--r-- | python/generic.h | 11 | ||||
| -rw-r--r-- | python/pkgsrcrecords.cc | 13 | ||||
| -rw-r--r-- | python/sourcelist.cc | 4 |
4 files changed, 25 insertions, 9 deletions
diff --git a/python/depcache.cc b/python/depcache.cc index ae6da3b9..d2ec4a8d 100644 --- a/python/depcache.cc +++ b/python/depcache.cc @@ -43,9 +43,6 @@ struct PkgDepCacheStruct delete depcache; delete policy; }; - - - PkgDepCacheStruct() {abort();}; }; @@ -439,11 +436,10 @@ static PyMethodDef PkgDepCacheMethods[] = {"MarkedInstall",PkgDepCacheMarkedInstall,METH_VARARGS,"Is pkg marked for install"}, {"MarkedUpgrade",PkgDepCacheMarkedUpgrade,METH_VARARGS,"Is pkg marked for upgrade"}, {"MarkedDelete",PkgDepCacheMarkedDelete,METH_VARARGS,"Is pkg marked for delete"}, - {"MarkedKeep",PkgDepCacheMarkedDelete,METH_VARARGS,"Is pkg marked for keep"}, + {"MarkedKeep",PkgDepCacheMarkedKeep,METH_VARARGS,"Is pkg marked for keep"}, // Action {"Commit", PkgDepCacheCommit, METH_VARARGS, "Commit pending changes"}, - {} }; diff --git a/python/generic.h b/python/generic.h index bcdf5806..a808e28d 100644 --- a/python/generic.h +++ b/python/generic.h @@ -33,6 +33,17 @@ template <class T> struct CppPyObject : public PyObject { + // We are only using CppPyObject and friends as dumb structs only, ie the + // c'tor is never called. + // However if T doesn't have a default c'tor C++ doesn't generate one for + // CppPyObject (since it can't know how it should initialize Object). + // + // This causes problems then in CppOwnedPyObject, for which C++ can't create + // a c'tor that calls the base class c'tor (which causes a compilation + // error). + // So basically having the c'tor here removes the need for T to have a + // default c'tor, which is not always desireable. + CppPyObject() { }; T Object; }; diff --git a/python/pkgsrcrecords.cc b/python/pkgsrcrecords.cc index fb66284a..8eb9e5f3 100644 --- a/python/pkgsrcrecords.cc +++ b/python/pkgsrcrecords.cc @@ -26,6 +26,9 @@ struct PkgSrcRecordsStruct List.ReadMainList(); Records = new pkgSrcRecords(List); }; + ~PkgSrcRecordsStruct() { + delete Records; + }; }; // PkgSrcRecords Class /*{{{*/ @@ -43,7 +46,8 @@ static PyObject *PkgSrcRecordsLookup(PyObject *Self,PyObject *Args) Struct.Last = Struct.Records->Find(Name, false); if (Struct.Last == 0) { Struct.Records->Restart(); - return Py_None; + Py_INCREF(Py_None); + return HandleErrors(Py_None); } return Py_BuildValue("i", 1); @@ -124,6 +128,11 @@ PyTypeObject PkgSrcRecordsType = PyObject *GetPkgSrcRecords(PyObject *Self,PyObject *Args) { - return CppPyObject_NEW<PkgSrcRecordsStruct>(&PkgSrcRecordsType); + PyObject *Owner; + if (PyArg_ParseTuple(Args,"O!",&PkgCacheType,&Owner) == 0) + return 0; + + return HandleErrors(CppOwnedPyObject_NEW<PkgSrcRecordsStruct>(Owner, + &PkgSrcRecordsType)); } diff --git a/python/sourcelist.cc b/python/sourcelist.cc index 6f039244..e2343e1c 100644 --- a/python/sourcelist.cc +++ b/python/sourcelist.cc @@ -56,10 +56,10 @@ PyTypeObject PkgSourceListType = PyObject_HEAD_INIT(&PyType_Type) 0, // ob_size "pkgSourceList", // tp_name - sizeof(CppOwnedPyObject<PkgSourceListStruct>), // tp_basicsize + sizeof(CppPyObject<PkgSourceListStruct>), // tp_basicsize 0, // tp_itemsize // Methods - CppOwnedDealloc<PkgSourceListStruct>, // tp_dealloc + CppDealloc<PkgSourceListStruct>, // tp_dealloc 0, // tp_print PkgSourceListAttr, // tp_getattr 0, // tp_setattr |
