summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-10-02 16:18:59 +0300
committerPanu Matilainen <pmatilai@redhat.com>2009-10-02 16:18:59 +0300
commit305d634d27d8c480bc01250585d2a901e343851f (patch)
treed7fc44afff514968f76ebf6f643fb4525cf01ba9
parent1dffab5393fc8ed5cd81173be543db6b5c34785a (diff)
downloadlibrpm-tizen-305d634d27d8c480bc01250585d2a901e343851f.tar.gz
librpm-tizen-305d634d27d8c480bc01250585d2a901e343851f.tar.bz2
librpm-tizen-305d634d27d8c480bc01250585d2a901e343851f.zip
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
-rw-r--r--python/Makefile.am4
-rw-r--r--python/rpm/__init__.py4
-rw-r--r--python/rpm/transaction.py6
-rw-r--r--python/rpmmodule.c4
-rw-r--r--python/rpmts-py.c6
-rw-r--r--python/rpmts-py.h2
6 files changed, 12 insertions, 14 deletions
diff --git a/python/Makefile.am b/python/Makefile.am
index c326a6a8a..c11e675b0 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 de0f6838c..4a0c9b641 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 000000000..89150f7fc
--- /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 d034ddff2..3c021ff4e 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 3f440602d..24f807f18 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 2cd3399a1..6d5e45508 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