9 #define _MACRO_INTERNAL
11 #define _RPMTAG_INTERNAL
65 PyObject * result = NULL;
66 const char * buildRootURL =
rpmExpand(
"%{?buildroot}", NULL);
67 if (spec != NULL && *buildRootURL)
68 result = Py_BuildValue(
"s", buildRootURL);
69 buildRootURL =
_free(buildRootURL);
78 return (spec != NULL && spec->
prep != NULL)
87 return (spec != NULL && spec->
build != NULL)
96 return (spec != NULL && spec->
install != NULL)
105 return (spec != NULL && spec->
check != NULL)
114 return (spec != NULL && spec->
clean != NULL)
123 PyObject *sourceList, *srcUrl;
127 sourceList = PyList_New(0);
135 while (source != NULL) {
137 srcUrl = Py_BuildValue(
"(sii)", fullSource, source->
num, source->
flags);
139 Py_XDECREF(sourceList);
142 PyList_Append(sourceList, srcUrl);
143 source = source->
next;
146 return PyList_AsTuple(sourceList);
162 macroDict = PyDict_New();
169 if (mc->macroTable != NULL) {
171 for (i = 0; i < mc->firstFree; i++) {
174 if ((me = mc->macroTable[i]) == NULL) {
178 macro = PyDict_New();
180 PyMapping_SetItemString(macro,
"used", PyInt_FromLong(me->used));
181 PyMapping_SetItemString(macro,
"level", PyInt_FromLong(me->level));
182 if (me->opts && *me->opts)
183 PyMapping_SetItemString(macro,
"opts", PyString_FromString(me->opts));
184 if (me->body && *me->body)
185 PyMapping_SetItemString(macro,
"body", PyString_FromString(me->body));
186 PyMapping_SetItemString(macroDict, strdup(me->name), macro);
202 PyObject *headerList;
207 headerList = PyList_New(0);
213 package = spec->packages;
215 while (package != NULL) {
218 PyList_Append(headerList, (PyObject *)
hdr_Wrap(header));
219 package = package->next;
223 return PyList_AsTuple(headerList);
249 PyVarObject_HEAD_INIT(&PyType_Type, 0)
static PyObject * spec_get_headers(specObject *s)
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)
The structure used to store values for a package.
struct MacroEntry_s * MacroEntry