--- pynealpm.c 2005-12-15 02:02:18.000000000 +0100 +++ pynealpm.c.progress 2005-12-26 02:38:09.000000000 +0100 @@ -49,6 +49,7 @@ static PyObject* python_callback = NULL; static PyObject* alpm_transaction_callback_event = NULL; static PyObject* alpm_transaction_callback_conversation = NULL; +static PyObject* alpm_transaction_callback_progress = NULL; //static PyObject* alpm_log_action = NULL; static PyObject* retainer1;// = Py_BuildValue("[]"); @@ -1316,6 +1317,12 @@ Py_DECREF(arglist); } +static void alpm_transaction_pseudo_callback_progress(unsigned char event, + char *pkgname, int percent, int howmany, int remain) +{ + return; +} + static void alpm_transaction_pseudo_callback_conversation(unsigned char question, void *lpkg, void *spkg, void *treename, int *doreplace) { @@ -1359,11 +1366,11 @@ static PyObject *alpm_transaction_init(PyObject *self, PyObject *args) { - PyObject *cb_ev, *cb_conv; + PyObject *cb_ev, *cb_conv, *cb_progress; unsigned char type, flags; int iret; - if (!PyArg_ParseTuple(args, "BBOO", &type, &flags, &cb_ev, &cb_conv)){ + if (!PyArg_ParseTuple(args, "BBOO", &type, &flags, &cb_ev, &cb_conv, &cb_progress)){ return NULL; } @@ -1375,14 +1382,21 @@ return NULL; } + if (!PyFunction_Check(cb_progress)){ + return NULL; + } + alpm_transaction_callback_conversation = cb_conv; Py_INCREF(alpm_transaction_callback_conversation); alpm_transaction_callback_event = cb_ev; Py_INCREF(alpm_transaction_callback_event); + + alpm_transaction_callback_progress = cb_progress; + Py_INCREF(alpm_transaction_callback_progress); iret = alpm_trans_init(type, flags, alpm_transaction_pseudo_callback_event, - alpm_transaction_pseudo_callback_conversation); + alpm_transaction_pseudo_callback_conversation, alpm_transaction_pseudo_callback_progress); if (iret == -1) { PyErr_SetString(PyExc_RuntimeError, alpm_strerror(pm_errno));