From 16e35ece9c28cfd0257102b1e1ca69746e2b4b6e Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 1 Oct 2009 11:21:58 +0300 Subject: [PATCH] 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 --- python/rpmts-py.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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 } }; -- 2.7.4