projects
/
platform
/
upstream
/
rpm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f74def6
)
Support numeric expansion in rpm.expandMacro()
author
Panu Matilainen
<pmatilai@redhat.com>
Mon, 28 Sep 2009 14:23:28 +0000
(17:23 +0300)
committer
Panu Matilainen
<pmatilai@redhat.com>
Mon, 28 Sep 2009 14:23:28 +0000
(17:23 +0300)
python/rpmmacro-py.c
patch
|
blob
|
history
diff --git
a/python/rpmmacro-py.c
b/python/rpmmacro-py.c
index
ec99e18
..
660bd00
100644
(file)
--- a/
python/rpmmacro-py.c
+++ b/
python/rpmmacro-py.c
@@
-40,15
+40,21
@@
rpmmacro_DelMacro(PyObject * self, PyObject * args, PyObject * kwds)
PyObject *
rpmmacro_ExpandMacro(PyObject * self, PyObject * args, PyObject * kwds)
{
PyObject *
rpmmacro_ExpandMacro(PyObject * self, PyObject * args, PyObject * kwds)
{
- char *macro
, *str
;
+ char *macro;
PyObject *res;
PyObject *res;
+ int num = 0;
+ char * kwlist[] = {"macro", "numeric", NULL};
- if (!PyArg_ParseTuple
(args, "s", ¯o
))
+ if (!PyArg_ParseTuple
AndKeywords(args, kwds, "s|i", kwlist, ¯o, &num
))
return NULL;
return NULL;
- str = rpmExpand(macro, NULL);
- res = Py_BuildValue("s", str);
- free(str);
+ if (num) {
+ res = Py_BuildValue("i", rpmExpandNumeric(macro));
+ } else {
+ char *str = rpmExpand(macro, NULL);
+ res = Py_BuildValue("s", str);
+ free(str);
+ }
return res;
}
return res;
}