From: Michael Tremer Date: Mon, 27 Jun 2022 15:59:51 +0000 (+0000) Subject: archive: Export path as Python property X-Git-Tag: 0.9.28~715 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a21c4e9ad0741db8311e9c63c5fd0337e56cd36d;p=pakfire.git archive: Export path as Python property Signed-off-by: Michael Tremer --- diff --git a/src/_pakfire/archive.c b/src/_pakfire/archive.c index ced521b8b..5d9618842 100644 --- a/src/_pakfire/archive.c +++ b/src/_pakfire/archive.c @@ -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 }, };