From 2ede83b6598a3026c1f016a109220929f62b0829 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Wed, 23 Sep 2009 10:31:46 +0300 Subject: [PATCH] Add hdr.format(), deprecate hdr.sprintf() - sprintf() is a C'ism and format() is closer to current librpm anyway --- python/header-py.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/python/header-py.c b/python/header-py.c index 21a10bb..2ed8a7d 100644 --- a/python/header-py.c +++ b/python/header-py.c @@ -241,7 +241,7 @@ static PyObject * hdrFullFilelist(hdrObject * s) Py_RETURN_NONE; } -static PyObject * hdrSprintf(hdrObject * s, PyObject * args, PyObject * kwds) +static PyObject * hdrFormat(hdrObject * s, PyObject * args, PyObject * kwds) { char * fmt; char * r; @@ -264,6 +264,12 @@ static PyObject * hdrSprintf(hdrObject * s, PyObject * args, PyObject * kwds) return result; } +static PyObject * hdrSprintf(hdrObject * s, PyObject * args, PyObject * kwds) +{ + DEPRECATED_METHOD; + return hdrFormat(s, args, kwds); +} + static PyObject *hdrIsSource(hdrObject *s) { return PyBool_FromLong(headerIsSource(s->h)); @@ -319,6 +325,8 @@ static struct PyMethodDef hdr_methods[] = { NULL }, {"convert", (PyCFunction) hdrConvert, METH_VARARGS|METH_KEYWORDS, NULL }, + {"format", (PyCFunction) hdrFormat, METH_VARARGS|METH_KEYWORDS, + NULL }, {"has_key", (PyCFunction) hdrHasKey, METH_O, NULL }, {"sprintf", (PyCFunction) hdrSprintf, METH_VARARGS|METH_KEYWORDS, -- 2.7.4