summaryrefslogtreecommitdiff
path: root/python/rpmmacro-py.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2007-11-29 10:06:57 +0200
committerPanu Matilainen <pmatilai@redhat.com>2007-11-29 10:06:57 +0200
commit41fc048c9a1938dffae9660db1cc874125c878af (patch)
tree0f088113a70d2b68bb555c6bab0ed7fbe407787a /python/rpmmacro-py.c
parent44e1c051fcecc8db6033ed8a4d21c0d5cd1c8702 (diff)
downloadrpm-41fc048c9a1938dffae9660db1cc874125c878af.tar.gz
rpm-41fc048c9a1938dffae9660db1cc874125c878af.tar.bz2
rpm-41fc048c9a1938dffae9660db1cc874125c878af.zip
Lose the useless rpmrc python stuff, group macro handling to rpmmacro-py
Diffstat (limited to 'python/rpmmacro-py.c')
-rw-r--r--python/rpmmacro-py.c62
1 files changed, 62 insertions, 0 deletions
diff --git a/python/rpmmacro-py.c b/python/rpmmacro-py.c
new file mode 100644
index 000000000..28d5e3d05
--- /dev/null
+++ b/python/rpmmacro-py.c
@@ -0,0 +1,62 @@
+/** \ingroup py_c
+ * \file python/rpmmacro-py.c
+ */
+
+#include "system.h"
+
+#include "structmember.h"
+
+#include "rpmdebug-py.c"
+#include "rpmmacro-py.h"
+#include <rpmmacro.h>
+
+#include "debug.h"
+
+/**
+ */
+PyObject *
+rpmmacro_AddMacro(PyObject * self, PyObject * args, PyObject * kwds)
+{
+ char * name, * val;
+ char * kwlist[] = {"name", "value", NULL};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "ss:AddMacro", kwlist,
+ &name, &val))
+ return NULL;
+
+ addMacro(NULL, name, NULL, val, -1);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+/**
+ */
+PyObject *
+rpmmacro_DelMacro(PyObject * self, PyObject * args, PyObject * kwds)
+{
+ char * name;
+ char * kwlist[] = {"name", NULL};
+
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "s:DelMacro", kwlist, &name))
+ return NULL;
+
+ delMacro(NULL, name);
+
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+
+/**
+ */
+PyObject *
+rpmmacro_ExpandMacro(PyObject * self, PyObject * args, PyObject * kwds)
+{
+ char * macro;
+
+ if (!PyArg_ParseTuple(args, "s", &macro))
+ return NULL;
+
+ return Py_BuildValue("s", rpmExpand(macro, NULL));
+}
+