summaryrefslogtreecommitdiff
path: root/python/rpmfi-py.c
diff options
context:
space:
mode:
authorPanu Matilainen <Panu Matilainen pmatilai@redhat.com>2011-07-06 08:16:12 +0300
committerPanu Matilainen <Panu Matilainen pmatilai@redhat.com>2011-07-06 08:16:12 +0300
commita71a7981cc9f7c8f107e5a14c51e1963375da5b8 (patch)
tree7989ed773ac6bc56c98193d2e5b89a31542e81cc /python/rpmfi-py.c
parentba2401f74620618ee7d3161888be71328f6e3c4c (diff)
downloadlibrpm-tizen-a71a7981cc9f7c8f107e5a14c51e1963375da5b8.tar.gz
librpm-tizen-a71a7981cc9f7c8f107e5a14c51e1963375da5b8.tar.bz2
librpm-tizen-a71a7981cc9f7c8f107e5a14c51e1963375da5b8.zip
Revert the ds, ts, fi and spec python object creation commits
- Hasty push-finger syndrom, while its not exactly plain wrong to do things this way, it doesn't really make sense for these types either. Python's own file object permits reinitialization though, so leaving rpm.fd() the way it is now. - This reverts the following commits: d056df28c38e602d82b4f9b527c686037074e660 3f77c3146da46a49f44b17fa66139fbe2dd9e45c 7214b2e0a271b7a7b3df312c58593878cbf56504 dc50fb2863c81159fb4cc8b25ce3862720c0cce5
Diffstat (limited to 'python/rpmfi-py.c')
-rw-r--r--python/rpmfi-py.c27
1 files changed, 20 insertions, 7 deletions
diff --git a/python/rpmfi-py.c b/python/rpmfi-py.c
index 7dcf25d0e..a43fee323 100644
--- a/python/rpmfi-py.c
+++ b/python/rpmfi-py.c
@@ -288,20 +288,26 @@ static PyMappingMethods rpmfi_as_mapping = {
static int rpmfi_init(rpmfiObject * s, PyObject *args, PyObject *kwds)
{
- PyObject * to = NULL; /* unused */
+ s->active = 0;
+ return 0;
+}
+
+static PyObject * rpmfi_new(PyTypeObject * subtype, PyObject *args, PyObject *kwds)
+{
+ PyObject * to = NULL;
Header h = NULL;
+ rpmfi fi = NULL;
+ rpmTagVal tagN = RPMTAG_BASENAMES;
int flags = 0;
char * kwlist[] = {"header", "tag", "flags", NULL};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O&|Oi:rpmfi_init", kwlist,
hdrFromPyObject, &h, &to, &flags))
- return -1;
+ return NULL;
- rpmfiFree(s->fi);
- s->fi = rpmfiNew(NULL, h, RPMTAG_BASENAMES, flags);
- s->active = 0;
+ fi = rpmfiNew(NULL, h, tagN, flags);
- return 0;
+ return rpmfi_Wrap(subtype, fi);
}
static char rpmfi_doc[] =
@@ -346,11 +352,18 @@ PyTypeObject rpmfi_Type = {
0, /* tp_dictoffset */
(initproc) rpmfi_init, /* tp_init */
0, /* tp_alloc */
- PyType_GenericNew, /* tp_new */
+ (newfunc) rpmfi_new, /* tp_new */
0, /* tp_free */
0, /* tp_is_gc */
};
+/* ---------- */
+
+rpmfi fiFromFi(rpmfiObject * s)
+{
+ return s->fi;
+}
+
PyObject * rpmfi_Wrap(PyTypeObject *subtype, rpmfi fi)
{
rpmfiObject *s = (rpmfiObject *)subtype->tp_alloc(subtype, 0);