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)
32
char * kwlist[] = {"packageKey", "key", "dso", "fileInfo", NULL};
34
if (!PyArg_ParseTupleAndKeywords(args, kwds, "iOO!O!:Add", kwlist,
35
&pkgKey, &key, &rpmds_Type, &dso, &rpmfi_Type, &fio))
39
/* XXX transaction colors */
40
pkgKey = rpmalAdd(&s->al, pkgKey, key, dso->ds, fio->fi, 0);
42
return Py_BuildValue("i", pkgKey);
46
rpmal_Del(rpmalObject * s, PyObject * args, PyObject * kwds)
49
char * kwlist[] = {"key", NULL};
51
if (!PyArg_ParseTupleAndKeywords(args, kwds, "i:Del", kwlist, &pkgKey))
54
rpmalDel(s->al, pkgKey);
61
rpmal_AddProvides(rpmalObject * s, PyObject * args, PyObject * kwds)
65
char * kwlist[] = {"index", "packageIndex", "dso", NULL};
67
/* XXX: why is there an argument listed in the format string that
68
* isn't handled? Is that for transaction color? */
69
if (!PyArg_ParseTupleAndKeywords(args, kwds, "iOO!O!:AddProvides", kwlist,
70
&pkgKey, &rpmds_Type, &dso))
73
/* XXX transaction colors */
74
rpmalAddProvides(s->al, pkgKey, dso->ds, 0);
81
rpmal_MakeIndex(rpmalObject * s)
83
rpmalMakeIndex(s->al);
89
static struct PyMethodDef rpmal_methods[] = {
90
{"Debug", (PyCFunction)rpmal_Debug, METH_VARARGS|METH_KEYWORDS,
92
{"add", (PyCFunction)rpmal_Add, METH_VARARGS|METH_KEYWORDS,
94
{"delete", (PyCFunction)rpmal_Del, METH_VARARGS|METH_KEYWORDS,
96
{"addProvides",(PyCFunction)rpmal_AddProvides, METH_VARARGS|METH_KEYWORDS,
98
{"makeIndex",(PyCFunction)rpmal_MakeIndex, METH_NOARGS,
100
{NULL, NULL } /* sentinel */
106
rpmal_dealloc(rpmalObject * s)
109
s->al = rpmalFree(s->al);
114
static PyObject * rpmal_getattro(PyObject * o, PyObject * n)
116
return PyObject_GenericGetAttr(o, n);
119
static int rpmal_setattro(PyObject * o, PyObject * n, PyObject * v)
121
return PyObject_GenericSetAttr(o, n, v);
126
static char rpmal_doc[] =
129
PyTypeObject rpmal_Type = {
130
PyObject_HEAD_INIT(&PyType_Type)
132
"rpm.al", /* tp_name */
133
sizeof(rpmalObject), /* tp_basicsize */
136
(destructor) rpmal_dealloc, /* tp_dealloc */
137
(printfunc)0, /* tp_print */
138
(getattrfunc)0, /* tp_getattr */
139
(setattrfunc)0, /* tp_setattr */
140
(cmpfunc)0, /* tp_compare */
141
(reprfunc)0, /* tp_repr */
142
0, /* tp_as_number */
143
0, /* tp_as_sequence */
144
0, /* tp_as_mapping */
145
(hashfunc)0, /* tp_hash */
146
(ternaryfunc)0, /* tp_call */
147
(reprfunc)0, /* tp_str */
148
(getattrofunc) rpmal_getattro, /* tp_getattro */
149
(setattrofunc) rpmal_setattro, /* tp_setattro */
150
0, /* tp_as_buffer */
151
Py_TPFLAGS_DEFAULT, /* tp_flags */
152
rpmal_doc, /* tp_doc */
153
#if Py_TPFLAGS_HAVE_ITER
156
0, /* tp_richcompare */
157
0, /* tp_weaklistoffset */
158
(getiterfunc)0, /* tp_iter */
159
(iternextfunc)0, /* tp_iternext */
160
rpmal_methods, /* tp_methods */
165
0, /* tp_descr_get */
166
0, /* tp_descr_set */
167
0, /* tp_dictoffset */
181
rpmalObject *s = PyObject_New(rpmalObject, &rpmal_Type);