static PyObject* Pakfire_dist(PakfireObject* self, PyObject* args) {
struct pakfire_archive* archive = NULL;
const char* path = NULL;
- const char* target = NULL;
- char* result = NULL;
+ PyObject* ret = NULL;
int r;
- if (!PyArg_ParseTuple(args, "s|z", &path, &target))
+ // Parse arguments
+ if (!PyArg_ParseTuple(args, "s", &path))
return NULL;
Py_BEGIN_ALLOW_THREADS
- r = pakfire_dist(self->pakfire, path, &archive, &result);
+ r = pakfire_dist(self->pakfire, path, &archive, NULL);
if (r) {
Py_BLOCK_THREADS
PyErr_SetFromErrno(PyExc_OSError);
Py_END_ALLOW_THREADS
- PyObject* ret = PyUnicode_FromString(result);
- free(result);
+ // Create a new archive
+ ret = new_archive(&ArchiveType, archive);
- // XXX This is now very broken
+ if (archive)
+ pakfire_archive_unref(archive);
return ret;
}