Deprecate rpm.headerLoad()
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 23 Sep 2009 07:11:45 +0000 (10:11 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 23 Sep 2009 07:11:45 +0000 (10:11 +0300)
- this is not needed now, just call rpm.hdr(<blob) to load

python/header-py.c

index b8943a0..821d1f9 100644 (file)
@@ -329,6 +329,7 @@ static struct PyMethodDef hdr_methods[] = {
     {NULL,             NULL}           /* sentinel */
 };
 
+/* TODO: permit keyring check + retrofits on copy/load */
 static PyObject *hdr_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
 {
     PyObject *obj = NULL;
@@ -580,29 +581,10 @@ Header hdrGetHeader(hdrObject * s)
     return s->h;
 }
 
-PyObject * hdrLoad(PyObject * self, PyObject * args, PyObject * kwds)
+PyObject * hdrLoad(PyObject * s, PyObject * args, PyObject * kwds)
 {
-    PyObject * hdr;
-    char * obj;
-    Header h;
-    int len;
-    char * kwlist[] = {"headers", NULL};
-
-    if (!PyArg_ParseTupleAndKeywords(args, kwds, "s#", kwlist, &obj, &len))
-       return NULL;
-
-    /* copy is needed to avoid surprises from data swab in headerLoad(). */
-    h = headerCopyLoad(obj);
-    if (!h) {
-       PyErr_SetString(pyrpmError, "bad header");
-       return NULL;
-    }
-    headerConvert(h, HEADERCONV_RETROFIT_V3);
-
-    hdr = hdr_Wrap(h);
-    h = headerFree(h); /* XXX ref held by hdr */
-
-    return hdr;
+    DEPRECATED_METHOD;
+    return PyObject_Call((PyObject *) &hdr_Type, args, kwds);
 }
 
 PyObject * rpmReadHeaders (FD_t fd)