Permit passing spec parse flags in python too

- The preferred flags default would be RPMSPEC_NONE, but it would break
  compatibility with older rpm versions where rpm.spec() doesn't accept
  flags.
This commit is contained in:
Panu Matilainen 2010-09-02 16:14:46 +03:00
parent 8f642cba13
commit e452178719
1 changed files with 4 additions and 4 deletions

View File

@ -213,14 +213,14 @@ static PyGetSetDef spec_getseters[] = {
static PyObject *spec_new(PyTypeObject *subtype, PyObject *args, PyObject *kwds)
{
char * kwlist[] = {"specfile", NULL};
char * kwlist[] = {"specfile", "flags", NULL};
const char * specfile;
rpmSpec spec = NULL;
/* TODO: add arguments to control these */
/* XXX This is a dumb default but anything else breaks compatibility... */
rpmSpecFlags flags = (RPMSPEC_ANYARCH|RPMSPEC_FORCE);
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s:spec_new", kwlist,
&specfile))
if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|i:spec_new", kwlist,
&specfile, &flags))
return NULL;
spec = rpmSpecParse(specfile, flags, NULL);