]> git.ipfire.org Git - pakfire.git/commitdiff
python: Add switch to turn on stub mode
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 4 Feb 2025 18:09:20 +0000 (18:09 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 4 Feb 2025 18:09:20 +0000 (18:09 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/python/pakfire.c

index bfdb77e6e3503253f89e5766c8511be684b8b64a..962c399bbe4981f9396acab34972188f6fef3858 100644 (file)
@@ -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