1 --- rpm-5.4.16/python/spec-py.c~ 2016-03-16 17:22:00.000000000 +0200
2 +++ rpm-5.4.16/python/spec-py.c 2016-03-16 17:24:05.660232743 +0200
5 #include <rpmiotypes.h>
7 +#define _MACRO_INTERNAL
13 return makeHeader(spec->sourceHeader);
17 +spec_get_macros(specObject *s, void *closure)
21 + PyObject *macroDict;
24 + macroDict = PyDict_New();
28 + spec = specFromSpec(s);
29 + if ( spec != NULL) {
31 + if (mc->macroTable != NULL) {
33 + for (i = 0; i < mc->firstFree; i++) {
36 + if ((me = mc->macroTable[i]) == NULL) {
37 + /* XXX this should never happen */
40 + macro = PyDict_New();
42 + PyMapping_SetItemString(macro, "used", PyInt_FromLong(me->used));
43 + PyMapping_SetItemString(macro, "level", PyInt_FromLong(me->level));
44 + if (me->opts && *me->opts)
45 + PyMapping_SetItemString(macro, "opts", PyString_FromString(me->opts));
46 + if (me->body && *me->body)
47 + PyMapping_SetItemString(macro, "body", PyString_FromString(me->body));
48 + PyMapping_SetItemString(macroDict, strdup(me->name), macro);
60 static char spec_doc[] = "RPM Spec file object";
62 static PyGetSetDef spec_getseters[] = {
64 {"buildRoot", (getter) spec_get_buildroot, NULL, NULL },
65 {"packages", (getter) spec_get_packages, NULL, NULL },
66 {"sourceHeader", (getter) spec_get_source_header, NULL, NULL },
67 + {"macros", (getter) spec_get_macros, NULL, NULL },