Python APT C++ API¶
The C++ API provides functions to create Python objects from C++ objects and to retrieve the C++ object stored in the Python object. An object may have another Python object as its owner and keeps its owner alive for its lifetime. Some objects require an owner of a specific type, while others require none. Refer to the sections below for details.
The C++ API names use the name of the class in apt_pkg and are prefixed with Py. For each supported class, there is a _Type object, a _Check() function, a _CheckExact() function, a _FromCpp() and a _ToCpp() function.
New in version 0.7.100.
Acquire (pkgAcquire)¶
-
PyTypeObject
PyAcquire_Type¶ The type object for
apt_pkg.Acquireobjects.
-
int
PyAcquire_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.Acquireobject, or a subclass thereof.
-
int
PyAcquire_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.Acquireobject and no subclass thereof.
-
PyObject*
PyAcquire_FromCpp(pkgAcquire *acquire, bool delete, PyObject *owner)¶ Create a new
apt_pkg.Acquireobject from thepkgAcquirepointer given by the parameter acquire. If the parameter delete is true, the object pointed to by acquire will be deleted when the refcount of the return value reaches 0.
AcquireFile (pkgAcqFile)¶
-
PyTypeObject
PyAcquireFile_Type¶ The type object for
apt_pkg.AcquireFileobjects.
-
int
PyAcquireFile_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.AcquireFileobject, or a subclass thereof.
-
int
PyAcquireFile_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.AcquireFileobject and no subclass thereof.
-
PyObject*
PyAcquireFile_FromCpp(pkgAcqFile *file, bool delete, PyObject *owner)¶ Create a new
apt_pkg.AcquireFileobject from thepkgAcqFilepointer given by the parameter file. If the parameter delete is true, the object pointed to by file will be deleted when the reference count of the returned object reaches 0. The parameter owner should point to aapt_pkg.Acquireobject.
AcquireItem (pkgAcquire::Item)¶
-
PyTypeObject
PyAcquireItem_Type¶ The type object for
apt_pkg.AcquireItemobjects.
-
int
PyAcquireItem_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.AcquireItemobject, or a subclass thereof.
-
int
PyAcquireItem_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.AcquireItemobject and no subclass thereof.
-
PyObject*
PyAcquireItem_FromCpp(pkgAcquire::Item *item, bool delete, PyObject *owner)¶ Create a new
apt_pkg.AcquireItemobject from thepkgAcquire::Itempointer given by the parameter item. If the parameter delete is true, the object pointed to by item will be deleted when the reference count of the returned object reaches 0. The parameter owner should point to aapt_pkg.Acquireobject.
AcquireItemDesc (pkgAcquire::ItemDesc)¶
-
PyTypeObject
PyAcquireItemDesc_Type¶ The type object for
apt_pkg.AcquireItemDescobjects.
-
int
PyAcquireItemDesc_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.AcquireItemDescobject, or a subclass thereof.
-
int
PyAcquireItemDesc_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.AcquireItemDescobject and no subclass thereof.
-
PyObject*
PyAcquireItemDesc_FromCpp(pkgAcquire::ItemDesc *desc, bool delete, PyObject *owner)¶ Create a new
apt_pkg.AcquireItemDescobject from thepkgAcquire::ItemDescpointer given by the parameter desc. If the parameter delete is true, the object pointed to by desc will be deleted when the reference count of the returned object reaches 0. The parameter owner should point to aapt_pkg.AcquireItemobject.
AcquireWorker (pkgAcquire::Worker)¶
-
PyTypeObject
PyAcquireWorker_Type¶ The type object for
apt_pkg.AcquireWorkerobjects.
-
int
PyAcquireWorker_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.AcquireWorkerobject, or a subclass thereof.
-
int
PyAcquireWorker_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.AcquireWorkerobject and no subclass thereof.
-
PyObject*
PyAcquireWorker_FromCpp(pkgAcquire::Worker *worker, bool delete, PyObject *owner)¶ Create a new
apt_pkg.AcquireWorkerobject from thepkgAcquire::Workerpointer given by the parameter worker. If the parameter delete is true, the object pointed to by worker will be deleted when the reference count of the returned object reaches 0. The parameter owner should point to aapt_pkg.Acquireobject.
ActionGroup (pkgDepCache::ActionGroup)¶
-
PyTypeObject
PyActionGroup_Type¶ The type object for
apt_pkg.ActionGroupobjects.
-
int
PyActionGroup_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.ActionGroupobject, or a subclass thereof.
-
int
PyActionGroup_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.ActionGroupobject and no subclass thereof.
-
PyObject*
PyActionGroup_FromCpp(pkgDepCache::ActionGroup *agroup, bool delete, PyObject *owner)¶ Create a new
apt_pkg.ActionGroupobject from thepkgDepCache::ActionGrouppointer given by the parameter agroup. If the parameter delete is true, the object pointed to by agroup will be deleted when the reference count of the returned object reaches 0. The parameter owner should point to aapt_pkg.DepCacheobject.
Cache (pkgCache)¶
-
PyTypeObject
PyCache_Type¶ The type object for
apt_pkg.Cacheobjects.
-
int
PyCache_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.Cacheobject, or a subclass thereof.
-
int
PyCache_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.Cacheobject and no subclass thereof.
-
PyObject*
PyCache_FromCpp(pkgCache *cache, bool delete, PyObject *owner)¶ Create a new
apt_pkg.Cacheobject from thepkgCachepointer given by the parameter cache. If the parameter delete is true, the object pointed to by cache will be deleted when the reference count of the returned object reaches 0. The parameter owner shall point to a object of the typePyCacheFile_Type.
CacheFile (pkgCacheFile)¶
-
PyTypeObject
PyCacheFile_Type¶ The type object for CacheFile. This type is internal and not exported to Python anywhere.
-
int
PyCacheFile_Check(PyObject *object)¶ Check that the object object is of the type
PyCacheFile_Typeor a subclass thereof.
-
int
PyCacheFile_CheckExact(PyObject *object)¶ Check that the object object is of the type
PyCacheFile_Typeand no subclass thereof.
-
PyObject*
PyCacheFile_FromCpp(pkgCacheFile *file, bool delete, PyObject *owner)¶ Create a new
apt_pkg.CacheFileobject from thepkgCacheFilepointer given by the parameter file If the parameter delete is true, the object pointed to by file will be deleted when the reference count of the returned object reaches 0.
Cdrom (pkgCdrom)¶
-
PyTypeObject
PyCdrom_Type¶ The type object for
apt_pkg.Cdromobjects.
-
int
PyCdrom_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.Cdromobject, or a subclass thereof.
-
int
PyCdrom_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.Cdromobject and no subclass thereof.
-
PyObject*
PyCdrom_FromCpp(pkgCdrom &cdrom, bool delete, PyObject *owner)¶ Create a new
apt_pkg.Cdromobject from thepkgCdromreference given by the parameter cdrom. If the parameter delete is true, cdrom will be deleted when the reference count of the returned object reaches 0.
Configuration (Configuration)¶
-
PyTypeObject
PyConfiguration_Type¶ The type object for
apt_pkg.Configurationobjects.
-
int
PyConfiguration_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.Configurationobject, or a subclass thereof.
-
int
PyConfiguration_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.Configurationobject and no subclass thereof.
-
PyObject*
PyConfiguration_FromCpp(Configuration *cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.Configurationobject from theConfigurationpointer given by the parameter cpp. If the parameter delete is true, the object pointed to by cpp will be deleted when the reference count of the returned object reaches 0. The parameter owner may refer to a parent object (e.g. when exposing a sub tree of a configuration object).
DepCache (pkgDepCache)¶
-
PyTypeObject
PyDepCache_Type¶ The type object for
apt_pkg.DepCacheobjects.
-
int
PyDepCache_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.DepCacheobject, or a subclass thereof.
-
int
PyDepCache_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.DepCacheobject and no subclass thereof.
-
PyObject*
PyDepCache_FromCpp(pkgDepCache *cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.DepCacheobject from thepkgDepCachepointer given by the parameter cpp. If the parameter delete is true, the object pointed to by cpp will be deleted when the reference count of the returned object reaches 0. The parameter owner must be a PyObject of the typePyCache_Type.
Dependency (pkgCache::DepIterator)¶
-
PyTypeObject
PyDependency_Type¶ The type object for
apt_pkg.Dependencyobjects.
-
int
PyDependency_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.Dependencyobject, or a subclass thereof.
-
int
PyDependency_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.Dependencyobject and no subclass thereof.
-
PyObject*
PyDependency_FromCpp(pkgCache::DepIterator &cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.Dependencyobject from thepkgCache::DepIteratorreference given by the parameter cpp. If the parameter delete is true, cpp will be deleted when the reference count of the returned object reaches 0. The parameter owner must be a PyObject of the typePyPackage_Type.
Description (pkgCache::DescIterator)¶
-
PyTypeObject
PyDescription_Type¶ The type object for
apt_pkg.Descriptionobjects.
-
int
PyDescription_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.Descriptionobject, or a subclass thereof.
-
int
PyDescription_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.Descriptionobject and no subclass thereof.
-
PyObject*
PyDescription_FromCpp(pkgCache::DescIterator &cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.Descriptionobject from thepkgCache::DescIteratorreference given by the parameter cpp. If the parameter delete is true, cpp will be deleted when the reference count of the returned object reaches 0. The parameter owner must be a PyObject of the typePyPackage_Type.
Group (pkgCache::GrpIterator)¶
New in version 0.8.0.
-
PyTypeObject
PyGroup_Type¶ The type object for
apt_pkg.Groupobjects.
-
int
PyGroup_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.Groupobject, or a subclass thereof.
-
int
PyGroup_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.Groupobject and no subclass thereof.
-
PyObject*
PyGroup_FromCpp(pkgCache::GrpIterator &cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.Groupobject from thepkgCache::GrpIteratorreference given by the parameter cpp. If the parameter delete is true, cpp will be deleted when the reference count of the returned object reaches 0. The parameter owner should be a PyObject of the typePyCache_Type.
Hashes (Hashes)¶
-
PyTypeObject
PyHashes_Type¶ The type object for
apt_pkg.Hashesobjects.
-
int
PyHashes_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.Hashesobject, or a subclass thereof.
-
int
PyHashes_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.Hashesobject and no subclass thereof.
-
PyObject*
PyHashes_FromCpp(Hashes &cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.Hashesobject from theHashesreference given by the parameter cpp. If the parameter delete is true, cpp will be deleted when the reference count of the returned object reaches 0.
HashString (HashString)¶
-
PyTypeObject
PyHashString_Type¶ The type object for
apt_pkg.HashStringobjects.
-
int
PyHashString_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.HashStringobject, or a subclass thereof.
-
int
PyHashString_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.HashStringobject and no subclass thereof.
-
PyObject*
PyHashString_FromCpp(HashString *cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.HashStringobject from theHashStringpointer given by the parameter cpp. If the parameter delete is true, the object pointed to by cpp will be deleted when the reference count of the returned object reaches 0.
IndexRecords (indexRecords)¶
-
PyTypeObject
PyIndexRecords_Type¶ The type object for
apt_pkg.IndexRecordsobjects.
-
int
PyIndexRecords_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.IndexRecordsobject, or a subclass thereof.
-
int
PyIndexRecords_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.IndexRecordsobject and no subclass thereof.
-
PyObject*
PyIndexRecords_FromCpp(indexRecords *cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.IndexRecordsobject from theindexRecordspointer given by the parameter cpp. If the parameter delete is true, the object pointed to by cpp will be deleted when the reference count of the returned object reaches 0.
MetaIndex (metaIndex)¶
-
PyTypeObject
PyMetaIndex_Type¶ The type object for
apt_pkg.MetaIndexobjects.
-
int
PyMetaIndex_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.MetaIndexobject, or a subclass thereof.
-
int
PyMetaIndex_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.MetaIndexobject and no subclass thereof.
-
PyObject*
PyMetaIndex_FromCpp(metaIndex *cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.MetaIndexobject from themetaIndexpointer given by the parameter cpp. If the parameter delete is true, the object pointed to by cpp will be deleted when the reference count of the returned object reaches 0. The parameter owner should be a PyObject of the typePySourceList_Type.
Package (pkgCache::PkgIterator)¶
-
PyTypeObject
PyPackage_Type¶ The type object for
apt_pkg.Packageobjects.
-
int
PyPackage_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.Packageobject, or a subclass thereof.
-
int
PyPackage_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.Packageobject and no subclass thereof.
-
PyObject*
PyPackage_FromCpp(pkgCache::PkgIterator &cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.Packageobject from thepkgCache::PkgIteratorreference given by the parameter cpp. If the parameter delete is true, cpp will be deleted when the reference count of the returned object reaches 0. The parameter owner should be a PyObject of the typePyCache_Type.
PackageFile (pkgCache::PkgFileIterator)¶
-
PyTypeObject
PyPackageFile_Type¶ The type object for
apt_pkg.PackageFileobjects.
-
int
PyPackageFile_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.PackageFileobject, or a subclass thereof.
-
int
PyPackageFile_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.PackageFileobject and no subclass thereof.
-
PyObject*
PyPackageFile_FromCpp(pkgCache::PkgFileIterator &cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.PackageFileobject from thepkgCache::PkgFileIteratorreference given by the parameter cpp. If the parameter delete is true, cpp will be deleted when the reference count of the returned object reaches 0. The parameter owner should be a PyObject of the typePyCache_Type.
IndexFile (pkgIndexFile)¶
-
PyTypeObject
PyIndexFile_Type¶ The type object for
apt_pkg.IndexFileobjects.
-
int
PyIndexFile_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.IndexFileobject, or a subclass thereof.
-
int
PyIndexFile_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.IndexFileobject and no subclass thereof.
-
PyObject*
PyIndexFile_FromCpp(pkgIndexFile *cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.IndexFileobject from thepkgIndexFilepointer given by the parameter cpp. If the parameter delete is true, the object pointed to by cpp will be deleted when the reference count of the returned object reaches 0. The parameter owner should be a PyObject of the typePyMetaIndex_Type.
OrderList (pkgOrderList)¶
-
PyTypeObject
PyOrderList_Type¶ The type object for
apt_pkg.OrderListobjects.
-
int
PyOrderList_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.OrderListobject, or a subclass thereof.
-
int
PyOrderList_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.OrderListobject and no subclass thereof.
-
PyObject*
PyOrderList_FromCpp(pkgOrderList *cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.OrderListobject from thepkgOrderListpointer given by the parameter cpp. If the parameter delete is true, the object pointed to by cpp will be deleted when the reference count of the returned object reaches 0. The owner must be aapt_pkg.DepCacheobject.
PackageManager (pkgPackageManager)¶
-
PyTypeObject
PyPackageManager_Type¶ The type object for
apt_pkg.PackageManagerobjects.
-
int
PyPackageManager_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.PackageManagerobject, or a subclass thereof.
-
int
PyPackageManager_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.PackageManagerobject and no subclass thereof.
-
PyObject*
PyPackageManager_FromCpp(pkgPackageManager *cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.PackageManagerobject from thepkgPackageManagerpointer given by the parameter cpp. If the parameter delete is true, the object pointed to by cpp will be deleted when the reference count of the returned object reaches 0.
Policy (pkgPolicy)¶
-
PyTypeObject
PyPolicy_Type¶ The type object for
apt_pkg.Policyobjects.
-
int
PyPolicy_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.Policyobject, or a subclass thereof.
-
int
PyPolicy_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.Policyobject and no subclass thereof.
-
PyObject*
PyPolicy_FromCpp(pkgPolicy *cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.Policyobject from thepkgPolicypointer given by the parameter cpp. If the parameter delete is true, the object pointed to by cpp will be deleted when the reference count of the returned object reaches 0. The parameter owner must be a PyObject of the typePyCache_Type.
ProblemResolver (pkgProblemResolver)¶
-
PyTypeObject
PyProblemResolver_Type¶ The type object for
apt_pkg.ProblemResolverobjects.
-
int
PyProblemResolver_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.ProblemResolverobject, or a subclass thereof.
-
int
PyProblemResolver_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.ProblemResolverobject and no subclass thereof.
-
PyObject*
PyProblemResolver_FromCpp(pkgProblemResolver *cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.ProblemResolverobject from thepkgProblemResolverpointer given by the parameter cpp. If the parameter delete is true, the object pointed to by cpp will be deleted when the reference count of the returned object reaches 0. The parameter owner must be a PyObject of the typePyDepCache_Type.
SourceList (pkgSourceList)¶
-
PyTypeObject
PySourceList_Type¶ The type object for
apt_pkg.SourceListobjects.
-
int
PySourceList_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.SourceListobject, or a subclass thereof.
-
int
PySourceList_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.SourceListobject and no subclass thereof.
-
PyObject*
PySourceList_FromCpp(pkgSourceList *cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.SourceListobject from thepkgSourceListpointer given by the parameter cpp. If the parameter delete is true, the object pointed to by cpp will be deleted when the reference count of the returned object reaches 0.
TagFile (pkgTagFile)¶
-
PyTypeObject
PyTagFile_Type¶ The type object for
apt_pkg.TagFileobjects.
-
int
PyTagFile_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.TagFileobject, or a subclass thereof.
-
int
PyTagFile_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.TagFileobject and no subclass thereof.
-
PyObject*
PyTagFile_FromCpp(pkgTagFile &cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.TagFileobject from thepkgTagFilereference given by the parameter cpp. If the parameter delete is true, cpp will be deleted when the reference count of the returned object reaches 0. The parameter owner may be any Python object.
TagSection (pkgTagSection)¶
-
PyTypeObject
PyTagSection_Type¶ The type object for
apt_pkg.TagSectionobjects.
-
int
PyTagSection_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.TagSectionobject, or a subclass thereof.
-
int
PyTagSection_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.TagSectionobject and no subclass thereof.
-
PyObject*
PyTagSection_FromCpp(pkgTagSection &cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.TagSectionobject from thepkgTagSectionreference given by the parameter cpp. If the parameter delete is true, cpp will be deleted when the reference count of the returned object reaches 0. The parameter owner may be a PyObject of the typePyTagFile_Type.
Version (pkgCache::VerIterator)¶
-
PyTypeObject
PyVersion_Type¶ The type object for
apt_pkg.Versionobjects.
-
int
PyVersion_Check(PyObject *object)¶ Check that the object object is an
apt_pkg.Versionobject, or a subclass thereof.
-
int
PyVersion_CheckExact(PyObject *object)¶ Check that the object object is an
apt_pkg.Versionobject and no subclass thereof.
-
PyObject*
PyVersion_FromCpp(pkgCache::VerIterator &cpp, bool delete, PyObject *owner)¶ Create a new
apt_pkg.Versionobject from thepkgCache::VerIteratorreference given by the parameter cpp. If the parameter delete is true, cpp will be deleted when the reference count of the returned object reaches 0. The parameter owner must be a PyObject of the typePyPackage_Type.