9 #define _MACRO_INTERNAL
62 PyObject * result = NULL;
63 const char * buildRootURL =
rpmExpand(
"%{?buildroot}", NULL);
64 if (spec != NULL && *buildRootURL)
65 result = Py_BuildValue(
"s", buildRootURL);
66 buildRootURL =
_free(buildRootURL);
75 return (spec != NULL && spec->
prep != NULL)
84 return (spec != NULL && spec->
build != NULL)
93 return (spec != NULL && spec->
install != NULL)
102 return (spec != NULL && spec->
check != NULL)
111 return (spec != NULL && spec->
clean != NULL)
120 PyObject *sourceList, *srcUrl;
124 sourceList = PyList_New(0);
132 while (source != NULL) {
134 srcUrl = Py_BuildValue(
"(sii)", fullSource, source->
num, source->
flags);
136 Py_XDECREF(sourceList);
139 PyList_Append(sourceList, srcUrl);
140 source = source->
next;
143 return PyList_AsTuple(sourceList);
159 macroDict = PyDict_New();
166 if (mc->macroTable != NULL) {
168 for (i = 0; i < mc->firstFree; i++) {
171 if ((me = mc->macroTable[i]) == NULL) {
175 macro = PyDict_New();
177 PyMapping_SetItemString(macro,
"used", PyInt_FromLong(me->used));
178 PyMapping_SetItemString(macro,
"level", PyInt_FromLong(me->level));
179 if (me->opts && *me->opts)
180 PyMapping_SetItemString(macro,
"opts", PyString_FromString(me->opts));
181 if (me->body && *me->body)
182 PyMapping_SetItemString(macro,
"body", PyString_FromString(me->body));
183 PyMapping_SetItemString(macroDict, strdup(me->name), macro);
217 PyVarObject_HEAD_INIT(&PyType_Type, 0)
specObject * spec_Wrap(Spec spec)
static int spec_print(specObject *s)
struct specObject_s specObject
static PyObject * spec_get_install(specObject *s)
static PyMethodDef spec_Spec_methods[]
static PyObject * spec_get_buildroot(specObject *s)
Spec specFromSpec(specObject *s)
static PyObject * spec_get_clean(specObject *s)
static PyObject * spec_get_build(specObject *s)
static PyObject * spec_get_macros(specObject *s)
The structure used to store values parsed from a spec file.
char * rpmExpand(const char *arg,...)
Return (malloc'ed) concatenated macro expansion(s).
Spec freeSpec(Spec spec)
Destroy a spec file control structure.
static PyObject * spec_get_check(specObject *s)
static PyObject * spec_get_sources(specObject *s)
static void spec_dealloc(specObject *s)
char * rpmiobStr(rpmiob iob)
Return I/O buffer (as string).
struct MacroContext_s * MacroContext
static void * _free(const void *p)
Wrapper to free(3), hides const compilation noise, permit NULL, return NULL.
static PyObject * spec_get_prep(specObject *s)
struct MacroEntry_s * MacroEntry