File: libvirt-glib.c

package info (click to toggle)
libvirt-glib 0.1.9-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 6,048 kB
  • ctags: 5,059
  • sloc: ansic: 19,912; sh: 11,803; makefile: 739; xml: 222; python: 134; perl: 104
file content (59 lines) | stat: -rw-r--r-- 1,330 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/*
 * libvirt-glib.c: Binding the glib event loop integration to python
 *
 * Copyright (C) 2008 Red Hat, Inc., Inc.
 *
 * Daniel Berrange <berrange@redhat.com>
 */

//#include <config.h>

/* Horrible kludge to work around even more horrible name-space pollution
   via Python.h.  That file includes /usr/include/python2.5/pyconfig*.h,
   which has over 180 autoconf-style HAVE_* definitions.  Shame on them.  */
#undef HAVE_PTHREAD_H

#include <Python.h>
#include <glib.h>
#include "libvirt-glib/libvirt-glib.h"

#ifndef __CYGWIN__
extern void initlibvirtglibmod(void);
#else
extern void initcygvirtglibmod(void);
#endif

#define VIR_PY_NONE (Py_INCREF (Py_None), Py_None)

static PyObject *
libvirt_gvir_event_register(PyObject *self G_GNUC_UNUSED, PyObject *args G_GNUC_UNUSED) {
    gvir_event_register();

    return VIR_PY_NONE;
}


static PyMethodDef libvirtGLibMethods[] = {
    {(char *) "event_register", libvirt_gvir_event_register, METH_VARARGS, NULL},
    {NULL, NULL, 0, NULL}
};

void
#ifndef __CYGWIN__
initlibvirtglibmod
#else
initcygvirtglibmod
#endif
  (void)
{
    gvir_init(NULL, NULL);
    /* initialize the python extension module */
    Py_InitModule((char *)
#ifndef __CYGWIN__
                  "libvirtglibmod"
#else
                  "cygvirtglibmod"
#endif
                  , libvirtGLibMethods);

}