2 * \file python/rpmal-py.c
14 rpmal_Debug(rpmalObject * s, PyObject * args, PyObject * kwds)
16 char * kwlist[] = {"debugLevel", NULL};
18 if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", kwlist, &_rpmal_debug))
26 rpmal_Add(rpmalObject * s, PyObject * args, PyObject * kwds)
29 char * kwlist[] = {"package", NULL};
31 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:Add", kwlist,
42 rpmal_Del(rpmalObject * s, PyObject * args, PyObject * kwds)
45 char * kwlist[] = {"key", NULL};
47 if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:Del", kwlist, &p))
57 rpmal_MakeIndex(rpmalObject * s)
59 rpmalMakeIndex(s->al);
65 static struct PyMethodDef rpmal_methods[] = {
66 {"Debug", (PyCFunction)rpmal_Debug, METH_VARARGS|METH_KEYWORDS,
68 {"add", (PyCFunction)rpmal_Add, METH_VARARGS|METH_KEYWORDS,
70 {"delete", (PyCFunction)rpmal_Del, METH_VARARGS|METH_KEYWORDS,
72 {"makeIndex",(PyCFunction)rpmal_MakeIndex, METH_NOARGS,
74 {NULL, NULL } /* sentinel */
80 rpmal_dealloc(rpmalObject * s)
83 s->al = rpmalFree(s->al);
88 static PyObject * rpmal_getattro(PyObject * o, PyObject * n)
90 return PyObject_GenericGetAttr(o, n);
93 static int rpmal_setattro(PyObject * o, PyObject * n, PyObject * v)
95 return PyObject_GenericSetAttr(o, n, v);
100 static char rpmal_doc[] =
103 PyTypeObject rpmal_Type = {
104 PyObject_HEAD_INIT(&PyType_Type)
106 "rpm.al", /* tp_name */
107 sizeof(rpmalObject), /* tp_basicsize */
110 (destructor) rpmal_dealloc, /* tp_dealloc */
111 (printfunc)0, /* tp_print */
112 (getattrfunc)0, /* tp_getattr */
113 (setattrfunc)0, /* tp_setattr */
114 (cmpfunc)0, /* tp_compare */
115 (reprfunc)0, /* tp_repr */
116 0, /* tp_as_number */
117 0, /* tp_as_sequence */
118 0, /* tp_as_mapping */
119 (hashfunc)0, /* tp_hash */
120 (ternaryfunc)0, /* tp_call */
121 (reprfunc)0, /* tp_str */
122 (getattrofunc) rpmal_getattro, /* tp_getattro */
123 (setattrofunc) rpmal_setattro, /* tp_setattro */
124 0, /* tp_as_buffer */
125 Py_TPFLAGS_DEFAULT, /* tp_flags */
126 rpmal_doc, /* tp_doc */
127 #if Py_TPFLAGS_HAVE_ITER
130 0, /* tp_richcompare */
131 0, /* tp_weaklistoffset */
132 (getiterfunc)0, /* tp_iter */
133 (iternextfunc)0, /* tp_iternext */
134 rpmal_methods, /* tp_methods */
139 0, /* tp_descr_get */
140 0, /* tp_descr_set */
141 0, /* tp_dictoffset */
155 rpmalObject *s = PyObject_New(rpmalObject, &rpmal_Type);