diff options
author | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-04-16 00:44:41 -0500 |
---|---|---|
committer | Joshua Ismael Haase Hernández <hahj87@gmail.com> | 2011-04-16 00:44:41 -0500 |
commit | 7203e2e2631e29a79f4ea822c371d4e12c9c1a88 (patch) | |
tree | f0ada9061babb0f656afa90e438bba0f0f781241 /cron-jobs/check_archlinux/alpm.c | |
parent | deab65fad4ced009fb31f7033b1db8ef0af78aee (diff) | |
parent | 229a9c504cbd733c93cf91399dc54bedf5160cc5 (diff) |
Merge branch 'master' of ~/packages/dbscripts into prueba
Conflicts:
.gitignore
db-functions
Diffstat (limited to 'cron-jobs/check_archlinux/alpm.c')
-rw-r--r-- | cron-jobs/check_archlinux/alpm.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/cron-jobs/check_archlinux/alpm.c b/cron-jobs/check_archlinux/alpm.c new file mode 100644 index 0000000..0b7cd2c --- /dev/null +++ b/cron-jobs/check_archlinux/alpm.c @@ -0,0 +1,40 @@ +#include <Python.h> +#include <alpm.h> + +static PyObject * +alpm_vercmp(PyObject *self, PyObject *args) +{ + const char *v1, *v2; + int ret; + + if (!PyArg_ParseTuple(args, "ss", &v1, &v2)) + return NULL; + ret = alpm_pkg_vercmp(v1, v2); + return Py_BuildValue("i", ret); +} + +static PyMethodDef AlpmMethods[] = { + {"vercmp", alpm_vercmp, METH_VARARGS, + "Execute vercmp."}, + {NULL, NULL, 0, NULL} /* Sentinel */ +}; + +PyMODINIT_FUNC +initalpm(void) +{ + (void) Py_InitModule("alpm", AlpmMethods); +} + +int +main(int argc, char *argv[]) +{ + /* Pass argv[0] to the Python interpreter */ + Py_SetProgramName(argv[0]); + + /* Initialize the Python interpreter. Required. */ + Py_Initialize(); + + /* Add a static module */ + initalpm(); + return 0; +} |