Enable retrieving problem key from python too

This commit is contained in:
Panu Matilainen 2009-10-05 13:12:05 +03:00
parent 66589df18f
commit 4e647fd780
1 changed files with 11 additions and 0 deletions

View File

@ -35,6 +35,16 @@ static PyObject *rpmprob_get_altnevr(rpmProblemObject *s, void *closure)
return Py_BuildValue("s", rpmProblemGetAltNEVR(s->prob)); return Py_BuildValue("s", rpmProblemGetAltNEVR(s->prob));
} }
static PyObject *rpmprob_get_key(rpmProblemObject *s, void *closure)
{
fnpyKey key = rpmProblemGetKey(s->prob);
if (key) {
return Py_BuildValue("O", rpmProblemGetKey(s->prob));
} else {
Py_RETURN_NONE;
}
}
static PyObject *rpmprob_get_str(rpmProblemObject *s, void *closure) static PyObject *rpmprob_get_str(rpmProblemObject *s, void *closure)
{ {
return Py_BuildValue("s", rpmProblemGetStr(s->prob)); return Py_BuildValue("s", rpmProblemGetStr(s->prob));
@ -49,6 +59,7 @@ static PyGetSetDef rpmprob_getseters[] = {
{ "type", (getter)rpmprob_get_type, NULL, NULL }, { "type", (getter)rpmprob_get_type, NULL, NULL },
{ "pkgNEVR", (getter)rpmprob_get_pkgnevr, NULL, NULL }, { "pkgNEVR", (getter)rpmprob_get_pkgnevr, NULL, NULL },
{ "altNEVR", (getter)rpmprob_get_altnevr, NULL, NULL }, { "altNEVR", (getter)rpmprob_get_altnevr, NULL, NULL },
{ "key", (getter)rpmprob_get_key, NULL, NULL },
{ "_str", (getter)rpmprob_get_str, NULL, NULL }, { "_str", (getter)rpmprob_get_str, NULL, NULL },
{ "_num", (getter)rpmprob_get_num, NULL, NULL }, { "_num", (getter)rpmprob_get_num, NULL, NULL },
{ NULL } { NULL }