diff options
author | Cecil Hugh Watson <knoppmyth@gmail.com> | 2010-01-04 15:55:21 (GMT) |
---|---|---|
committer | Cecil Hugh Watson <knoppmyth@gmail.com> | 2010-01-04 15:55:21 (GMT) |
commit | 51486c041c85bbfb9a946e4711845c682d89c8f4 (patch) | |
tree | ac4514c0a76c312266734f96a05034c4d2469f87 /build_tools/bin/check_repo/alpm.c | |
parent | 1aeb0dc1e0cb97cb568d9cb554380cc2dc2a8e42 (diff) | |
parent | 1978b7ecea22e67fc13234f3622293cf0b807174 (diff) | |
download | linhes_dev-51486c041c85bbfb9a946e4711845c682d89c8f4.zip |
Merge branch 'HEAD' of ssh://cesman@knoppmyth.net/mount/repository/LinHES-dev
Diffstat (limited to 'build_tools/bin/check_repo/alpm.c')
-rw-r--r-- | build_tools/bin/check_repo/alpm.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/build_tools/bin/check_repo/alpm.c b/build_tools/bin/check_repo/alpm.c new file mode 100644 index 0000000..0b7cd2c --- /dev/null +++ b/build_tools/bin/check_repo/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; +} |