diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2009-10-02 16:36:53 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2009-10-02 16:36:53 +0300 |
commit | bc9b86ae5c14e093078506b533cede3c5f1f5ab9 (patch) | |
tree | fddd35d1794d9037291328da962e60d0c8767c13 | |
parent | 305d634d27d8c480bc01250585d2a901e343851f (diff) | |
download | librpm-tizen-bc9b86ae5c14e093078506b533cede3c5f1f5ab9.tar.gz librpm-tizen-bc9b86ae5c14e093078506b533cede3c5f1f5ab9.tar.bz2 librpm-tizen-bc9b86ae5c14e093078506b533cede3c5f1f5ab9.zip |
Move ts flag & color setting to python side
-rw-r--r-- | python/rpm/transaction.py | 25 | ||||
-rw-r--r-- | python/rpmts-py.c | 60 |
2 files changed, 24 insertions, 61 deletions
diff --git a/python/rpm/transaction.py b/python/rpm/transaction.py index 89150f7fc..0d24de854 100644 --- a/python/rpm/transaction.py +++ b/python/rpm/transaction.py @@ -2,5 +2,28 @@ import _rpm +# TODO: migrate relevant documentation from C-side class TransactionSet(_rpm.ts): - pass + def _wrapSetGet(self, attr, val): + oval = getattr(self, attr) + setattr(self, attr, val) + return oval + + def setVSFlags(self, flags): + return _wrapSetGet('_vsflags', flags) + + def getVSFlags(self): + return self._vsflags + + def setColor(self, color): + return _wrapSetGet('_color', color) + + def setPrefColor(self, color): + return _wrapSetGet('_prefcolor', color) + + def setFlags(self, flags): + return _wrapSetGet('_flags', flags) + + def setProbFilter(self, ignoreSet): + return _wrapSetGet('_probFilter', ignoreSet) + diff --git a/python/rpmts-py.c b/python/rpmts-py.c index 24f807f18..b69324c76 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -527,31 +527,6 @@ rpmts_HdrCheck(rpmtsObject * s, PyObject * args, PyObject * kwds) return result; } -static PyObject * wrapSetGetOld(rpmtsObject *s, const char *name, PyObject *val) -{ - PyObject *oval = PyObject_GetAttrString((PyObject *)s, name); - if (PyObject_SetAttrString((PyObject *)s, name, val) == -1) { - Py_XDECREF(oval); - oval = NULL; - } - return oval; -} - -static PyObject * rpmts_SetVSFlags(rpmtsObject * s, PyObject * arg) -{ - return wrapSetGetOld(s, "_vsflags", arg); -} - -static PyObject * rpmts_GetVSFlags(rpmtsObject * s) -{ - return PyObject_GetAttrString((PyObject *)s, "_vsflags"); -} - -static PyObject * rpmts_SetColor(rpmtsObject * s, PyObject * arg) -{ - return wrapSetGetOld(s, "_color", arg); -} - static PyObject * rpmts_PgpPrtPkts(rpmtsObject * s, PyObject * args, PyObject * kwds) { @@ -679,16 +654,6 @@ rpmtsCallback(const void * hd, const rpmCallbackType what, return NULL; } -static PyObject * rpmts_SetFlags(rpmtsObject * s, PyObject * arg) -{ - return wrapSetGetOld(s, "_flags", arg); -} - -static PyObject * rpmts_SetProbFilter(rpmtsObject * s, PyObject * arg) -{ - return wrapSetGetOld(s, "_probFilter", arg); -} - static PyObject * rpmts_Problems(rpmtsObject * s) { @@ -841,14 +806,6 @@ static struct PyMethodDef rpmts_methods[] = { NULL }, {"order", (PyCFunction) rpmts_Order, METH_NOARGS, NULL }, - {"setFlags", (PyCFunction) rpmts_SetFlags, METH_O, -"ts.setFlags(transFlags) -> previous transFlags\n\ -- Set control bit(s) for executing ts.run().\n\ - Note: This method replaces the 1st argument to the old ts.run()\n" }, - {"setProbFilter", (PyCFunction) rpmts_SetProbFilter, METH_O, -"ts.setProbFilter(ignoreSet) -> previous ignoreSet\n\ -- Set control bit(s) for ignoring problems found by ts.run().\n\ - Note: This method replaces the 2nd argument to the old ts.run()\n" }, {"problems", (PyCFunction) rpmts_Problems, METH_NOARGS, "ts.problems() -> ps\n\ - Return current problem set.\n" }, @@ -881,23 +838,6 @@ static struct PyMethodDef rpmts_methods[] = { - Read a package header from a file descriptor.\n" }, {"hdrCheck", (PyCFunction) rpmts_HdrCheck, METH_VARARGS|METH_KEYWORDS, NULL }, - {"setVSFlags",(PyCFunction) rpmts_SetVSFlags, METH_O, -"ts.setVSFlags(vsflags) -> ovsflags\n\ -- Set signature verification flags. Values for vsflags are:\n\ - rpm.RPMVSF_NOHDRCHK if set, don't check rpmdb headers\n\ - rpm.RPMVSF_NEEDPAYLOAD if not set, check header+payload (if possible)\n\ - rpm.RPMVSF_NOSHA1HEADER if set, don't check header SHA1 digest\n\ - rpm.RPMVSF_NODSAHEADER if set, don't check header DSA signature\n\ - rpm.RPMVSF_NOMD5 if set, don't check header+payload MD5 digest\n\ - rpm.RPMVSF_NODSA if set, don't check header+payload DSA signature\n\ - rpm.RPMVSF_NORSA if set, don't check header+payload RSA signature\n\ - rpm._RPMVSF_NODIGESTS if set, don't check digest(s)\n\ - rpm._RPMVSF_NOSIGNATURES if set, don't check signature(s)\n" }, - {"getVSFlags",(PyCFunction) rpmts_GetVSFlags, METH_NOARGS, -"ts.getVSFlags() -> vsflags\n\ -- Retrieve current signature verification flags from transaction\n" }, - {"setColor",(PyCFunction) rpmts_SetColor, METH_O, - NULL }, {"pgpPrtPkts", (PyCFunction) rpmts_PgpPrtPkts, METH_VARARGS|METH_KEYWORDS, NULL }, {"pgpImportPubkey", (PyCFunction) rpmts_PgpImportPubkey, METH_VARARGS|METH_KEYWORDS, |