From: Panu Matilainen Date: Thu, 1 Oct 2009 08:21:58 +0000 (+0300) Subject: Make python ts rootDir appear as a read-only attribute X-Git-Tag: rpm-4.8.0-beta1~165 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=16e35ece9c28cfd0257102b1e1ca69746e2b4b6e;p=platform%2Fupstream%2Frpm.git Make python ts rootDir appear as a read-only attribute - there's no need to change the rootdir after object creation, better not permit at all --- diff --git a/python/rpmts-py.c b/python/rpmts-py.c index 3647662..8e069c1 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -972,7 +972,6 @@ static PyObject * rpmts_new(PyTypeObject * subtype, PyObject *args, PyObject *kw return NULL; ts = rpmtsCreate(); - /* XXX: Why is there no rpmts_SetRootDir() ? */ (void) rpmtsSetRootDir(ts, rootDir); /* XXX: make this use common code with rpmts_SetVSFlags() to check the * python objects */ @@ -986,6 +985,11 @@ static PyObject *rpmts_get_tid(rpmtsObject *s, void *closure) return Py_BuildValue("i", rpmtsGetTid(s->ts)); } +static PyObject *rpmts_get_rootDir(rpmtsObject *s, void *closure) +{ + return Py_BuildValue("s", rpmtsRootDir(s->ts)); +} + static int rpmts_set_scriptFd(rpmtsObject *s, PyObject *value, void *closure) { int rc = 0; @@ -1008,6 +1012,7 @@ static PyGetSetDef rpmts_getseters[] = { /* only provide a setter until we have rpmfd wrappings */ {"scriptFd", NULL, (setter)rpmts_set_scriptFd, NULL }, {"tid", (getter)rpmts_get_tid, NULL, NULL }, + {"rootDir", (getter)rpmts_get_rootDir, NULL, NULL }, { NULL } };