From e25456d5a96f8ccf05073cb1d17b91afee024883 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 4 Feb 2025 18:09:20 +0000 Subject: [PATCH] python: Add switch to turn on stub mode Signed-off-by: Michael Tremer --- src/python/pakfire.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/python/pakfire.c b/src/python/pakfire.c index bfdb77e6..962c399b 100644 --- a/src/python/pakfire.c +++ b/src/python/pakfire.c @@ -59,18 +59,24 @@ static PyObject* Pakfire_new(PyTypeObject* type, PyObject* args, PyObject* kwds) } static int Pakfire_init(PakfireObject* self, PyObject* args, PyObject* kwds) { - const char* kwlist[] = { "ctx", "path", "arch", "config", NULL }; + const char* kwlist[] = { "ctx", "path", "arch", "config", "stub", NULL }; struct pakfire_config* c = NULL; const char* config = NULL; const char* path = NULL; const char* arch = NULL; CtxObject* ctx = NULL; + int flags = 0; + int stub = 0; int r; - if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|zzz", (char**)kwlist, - &CtxType, &ctx, &path, &arch, &config)) + if (!PyArg_ParseTupleAndKeywords(args, kwds, "O!|zzzb", (char**)kwlist, + &CtxType, &ctx, &path, &arch, &config, &stub)) return -1; + // Setup flags + if (stub) + flags |= PAKFIRE_FLAGS_STUB; + // Create a new configuration object r = pakfire_config_create(&c); if (r < 0) { @@ -95,7 +101,7 @@ static int Pakfire_init(PakfireObject* self, PyObject* args, PyObject* kwds) { self->ctx = pakfire_ctx_ref(ctx->ctx); // Create a new Pakfire instance - r = pakfire_create(&self->pakfire, self->ctx, c, path, arch, 0); + r = pakfire_create(&self->pakfire, self->ctx, c, path, arch, flags); Py_END_ALLOW_THREADS -- 2.39.5