summaryrefslogtreecommitdiff
path: root/python/acquire.cc
diff options
context:
space:
mode:
Diffstat (limited to 'python/acquire.cc')
-rw-r--r--python/acquire.cc73
1 files changed, 72 insertions, 1 deletions
diff --git a/python/acquire.cc b/python/acquire.cc
index c3f2fc5d..6c4baf9c 100644
--- a/python/acquire.cc
+++ b/python/acquire.cc
@@ -20,6 +20,78 @@ struct PyAcquireObject : public CppPyObject<pkgAcquire*> {
vector<PyAcquireItemObject *> items;
};
+static PyObject *acquireitemdesc_get_uri(PyObject *self, void *closure)
+{
+ return CppPyString(GetCpp<pkgAcquire::ItemDesc>(self).URI);
+}
+static PyObject *acquireitemdesc_get_description(PyObject *self, void *closure)
+{
+ return CppPyString(GetCpp<pkgAcquire::ItemDesc>(self).Description);
+}
+static PyObject *acquireitemdesc_get_shortdesc(PyObject *self, void *closure)
+{
+ return CppPyString(GetCpp<pkgAcquire::ItemDesc>(self).ShortDesc);
+}
+static PyObject *acquireitemdesc_get_owner(PyObject *self, void *closure)
+{
+ return GetOwner<pkgAcquire::ItemDesc>(self);
+}
+
+static PyGetSetDef acquireitemdesc_getset[] = {
+ {"uri",acquireitemdesc_get_uri,0,"The URI from which to download this item."},
+ {"description",acquireitemdesc_get_description},
+ {"shortdesc",acquireitemdesc_get_shortdesc},
+ {"owner",acquireitemdesc_get_owner},
+ {NULL}
+};
+
+static char *acquireitemdesc_doc =
+ "Represent an AcquireItemDesc";
+
+PyTypeObject PyAcquireItemDesc_Type =
+{
+ PyVarObject_HEAD_INIT(&PyType_Type, 0)
+ "apt_pkg.AcquireItemDesc", // tp_name
+ sizeof(CppOwnedPyObject<pkgAcquire::ItemDesc>),// tp_basicsize
+ 0, // tp_itemsize
+ // Methods
+ CppOwnedDealloc<pkgAcquire::ItemDesc>, // tp_dealloc
+ 0, // tp_print
+ 0, // tp_getattr
+ 0, // tp_setattr
+ 0, // tp_compare
+ 0, // tp_repr
+ 0, // tp_as_number
+ 0, // tp_as_sequence
+ 0, // tp_as_mapping
+ 0, // tp_hash
+ 0, // tp_call
+ 0, // tp_str
+ 0, // tp_getattro
+ 0, // tp_setattro
+ 0, // tp_as_buffer
+ (Py_TPFLAGS_DEFAULT | // tp_flags
+ Py_TPFLAGS_HAVE_GC),
+ acquireitemdesc_doc, // tp_doc
+ CppOwnedTraverse<pkgAcquire::ItemDesc>,// tp_traverse
+ CppOwnedClear<pkgAcquire::ItemDesc>, // tp_clear
+ 0, // tp_richcompare
+ 0, // tp_weaklistoffset
+ 0, // tp_iter
+ 0, // tp_iternext
+ 0, // tp_methods
+ 0, // tp_members
+ acquireitemdesc_getset, // tp_getset
+ 0, // tp_base
+ 0, // tp_dict
+ 0, // tp_descr_get
+ 0, // tp_descr_set
+ 0, // tp_dictoffset
+ 0, // tp_init
+ 0, // tp_alloc
+ 0, // tp_new
+};
+
inline pkgAcquire::Item *acquireitem_tocpp(PyObject *self) {
pkgAcquire::Item *itm = GetCpp<pkgAcquire::Item*>(self);
if (itm == 0)
@@ -47,7 +119,6 @@ MkGet(AcquireItemGetIsTrusted,Py_BuildValue("i",Itm->IsTrusted()));
MkGet(AcquireItemGetLocal,Py_BuildValue("i",Itm->Local));
MkGet(AcquireItemGetStatus,Py_BuildValue("i",Itm->Status));
-
// Constants
MkGet(AcquireItemGetStatIdle,Py_BuildValue("i", pkgAcquire::Item::StatIdle));
MkGet(AcquireItemGetStatFetching,Py_BuildValue("i", pkgAcquire::Item::StatFetching));