diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2010-10-01 15:05:35 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2010-10-01 15:05:35 +0300 |
commit | 7f16947a0a16c1e6e2d38f5d3f5b20fa2f4ee4ec (patch) | |
tree | 2cb98ff7c4da9f7e5616a845af4213f7a0b999b6 /python | |
parent | f94d1507e5a3e82293061c9c3dc4d34008cee390 (diff) | |
download | librpm-tizen-7f16947a0a16c1e6e2d38f5d3f5b20fa2f4ee4ec.tar.gz librpm-tizen-7f16947a0a16c1e6e2d38f5d3f5b20fa2f4ee4ec.tar.bz2 librpm-tizen-7f16947a0a16c1e6e2d38f5d3f5b20fa2f4ee4ec.zip |
Use the new spec src/pkg API in python instead of direct access to spec
Diffstat (limited to 'python')
-rw-r--r-- | python/spec-py.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/python/spec-py.c b/python/spec-py.c index 6cc107d21..891b362f4 100644 --- a/python/spec-py.c +++ b/python/spec-py.c @@ -53,8 +53,7 @@ static char specPkg_doc[] = static PyObject * specpkg_get_header(specPkgObject *s, void *closure) { - Package pkg = s->pkg; - return makeHeader(pkg->header); + return makeHeader(rpmSpecPkgHeader(s->pkg)); } static PyGetSetDef specpkg_getseters[] = { @@ -170,16 +169,19 @@ static PyObject * spec_get_clean(specObject * s, void *closure) static PyObject * spec_get_sources(specObject *s, void *closure) { - rpmSpec spec = s->spec; PyObject *sourceList = PyList_New(0); rpmSpecSrc source; - for (source = spec->sources; source; source = source->next) { - PyObject *srcUrl = Py_BuildValue("(sii)", source->fullSource, - source->num, source->flags); + rpmSpecSrcIter iter = rpmSpecSrcIterInit(s->spec); + while ((source = rpmSpecSrcIterNext(iter)) != NULL) { + PyObject *srcUrl = Py_BuildValue("(sii)", + rpmSpecSrcFilename(source, 1), + rpmSpecSrcNum(source), + rpmSpecSrcFlags(source)); PyList_Append(sourceList, srcUrl); Py_DECREF(srcUrl); } + rpmSpecSrcIterFree(iter); return sourceList; @@ -187,15 +189,16 @@ static PyObject * spec_get_sources(specObject *s, void *closure) static PyObject * spec_get_packages(specObject *s, void *closure) { - rpmSpec spec = s->spec; - PyObject *pkgList = PyList_New(0); rpmSpecPkg pkg; + PyObject *pkgList = PyList_New(0); + rpmSpecPkgIter iter = rpmSpecPkgIterInit(s->spec); - for (pkg = spec->packages; pkg; pkg = pkg->next) { + while ((pkg = rpmSpecPkgIterNext(iter)) != NULL) { PyObject *po = specPkg_Wrap(&specPkg_Type, pkg); PyList_Append(pkgList, po); Py_DECREF(po); } + rpmSpecPkgIterFree(iter); return pkgList; } |