]> git.ipfire.org Git - pakfire.git/commitdiff
archive: Export path as Python property
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 27 Jun 2022 15:59:51 +0000 (15:59 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 15 Jul 2022 11:45:56 +0000 (11:45 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/_pakfire/archive.c

index ced521b8bb4c5cf9b06fc19f476127fcd562c059..5d96188426c767804065e8f026e09a414e94d257 100644 (file)
@@ -199,6 +199,14 @@ static PyObject* Archive_get(ArchiveObject* self, PyObject* args) {
        return ret;
 }
 
+static PyObject* Archive_get_path(ArchiveObject* self) {
+       const char* path = pakfire_archive_get_path(self->archive);
+       if (!path)
+               Py_RETURN_NONE;
+
+       return PyUnicode_FromString(path);
+}
+
 static struct PyMethodDef Archive_methods[] = {
        {
                "extract",
@@ -247,6 +255,13 @@ static struct PyGetSetDef Archive_getsetters[] = {
                NULL,
                NULL
        },
+       {
+               "path",
+               (getter)Archive_get_path,
+               NULL,
+               NULL,
+               NULL
+       },
        { NULL },
 };