From 305d634d27d8c480bc01250585d2a901e343851f Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 2 Oct 2009 16:18:59 +0300 Subject: [PATCH] Add a dummy python-level transaction set class, use it always - move the rpm.ts() vs rpm.TransactionSet() compatibility to python - this will enable doing only the lowest level stuff in C and rest in python --- python/Makefile.am | 4 ++-- python/rpm/__init__.py | 4 ++++ python/rpm/transaction.py | 6 ++++++ python/rpmmodule.c | 4 ---- python/rpmts-py.c | 6 ------ python/rpmts-py.h | 2 -- 6 files changed, 12 insertions(+), 14 deletions(-) create mode 100644 python/rpm/transaction.py diff --git a/python/Makefile.am b/python/Makefile.am index c326a6a..c11e675 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -1,6 +1,6 @@ # Makefile for rpm library. -EXTRA_DIST = rpm/__init__.py +EXTRA_DIST = rpm/__init__.py rpm/transaction.py if PYTHON AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir) -I$(top_builddir)/include/ @@ -9,7 +9,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/misc AM_CPPFLAGS += -I@WITH_PYTHON_INCLUDE@ pkgpyexec_LTLIBRARIES = _rpmmodule.la -pkgpyexec_DATA = rpm/__init__.py +pkgpyexec_DATA = rpm/__init__.py rpm/transaction.py _rpmmodule_la_LDFLAGS = -module -avoid-version _rpmmodule_la_LIBADD = \ diff --git a/python/rpm/__init__.py b/python/rpm/__init__.py index de0f683..4a0c9b6 100644 --- a/python/rpm/__init__.py +++ b/python/rpm/__init__.py @@ -7,6 +7,7 @@ This module enables you to manipulate rpms and the rpm database. import warnings import os from _rpm import * +from transaction import * import _rpm _RPMVSF_NODIGESTS = _rpm._RPMVSF_NODIGESTS @@ -14,6 +15,9 @@ _RPMVSF_NOHEADER = _rpm._RPMVSF_NOHEADER _RPMVSF_NOPAYLOAD = _rpm._RPMVSF_NOPAYLOAD _RPMVSF_NOSIGNATURES = _rpm._RPMVSF_NOSIGNATURES +# backwards compatibility + give the same class both ways +ts = TransactionSet + def headerLoad(*args, **kwds): warnings.warn("Use rpm.hdr() instead.", DeprecationWarning, stacklevel=2) return hdr(*args, **kwds) diff --git a/python/rpm/transaction.py b/python/rpm/transaction.py new file mode 100644 index 0000000..89150f7 --- /dev/null +++ b/python/rpm/transaction.py @@ -0,0 +1,6 @@ +#!/usr/bin/python + +import _rpm + +class TransactionSet(_rpm.ts): + pass diff --git a/python/rpmmodule.c b/python/rpmmodule.c index d034ddf..3c021ff 100644 --- a/python/rpmmodule.c +++ b/python/rpmmodule.c @@ -113,10 +113,6 @@ static PyObject * setStats (PyObject * self, PyObject * args, PyObject * kwds) } static PyMethodDef rpmModuleMethods[] = { - { "TransactionSet", (PyCFunction) rpmts_Create, METH_VARARGS|METH_KEYWORDS, -"rpm.TransactionSet([rootDir, [db]]) -> ts\n\ -- Create a transaction set.\n" }, - { "addMacro", (PyCFunction) rpmmacro_AddMacro, METH_VARARGS|METH_KEYWORDS, NULL }, { "delMacro", (PyCFunction) rpmmacro_DelMacro, METH_VARARGS|METH_KEYWORDS, diff --git a/python/rpmts-py.c b/python/rpmts-py.c index 3f44060..24f807f 100644 --- a/python/rpmts-py.c +++ b/python/rpmts-py.c @@ -1094,12 +1094,6 @@ PyTypeObject rpmts_Type = { 0, /* tp_is_gc */ }; -PyObject * -rpmts_Create(PyObject * self, PyObject * args, PyObject * kwds) -{ - return PyObject_Call((PyObject *) &rpmts_Type, args, kwds); -} - PyObject * rpmts_Wrap(PyTypeObject *subtype, rpmts ts) { rpmtsObject * s = (rpmtsObject *)subtype->tp_alloc(subtype, 0); diff --git a/python/rpmts-py.h b/python/rpmts-py.h index 2cd3399..6d5e455 100644 --- a/python/rpmts-py.h +++ b/python/rpmts-py.h @@ -17,6 +17,4 @@ enum { PyObject * rpmts_Wrap(PyTypeObject *subtype, rpmts ts); -PyObject * rpmts_Create(PyObject * s, PyObject * args, PyObject * kwds); - #endif -- 2.7.4