3 * Copyright (C) 2015 IPFire Team (www.ipfire.org)
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "_collectymodule.h"
23 static PyMethodDef collecty_module_methods
[] = {
24 {"get_detected_sensors", (PyCFunction
)_collecty_get_detected_sensors
, METH_VARARGS
, NULL
},
25 {"get_mountpoints", (PyCFunction
)_collecty_get_mountpoints
, METH_NOARGS
, NULL
},
26 {"sensors_cleanup", (PyCFunction
)_collecty_sensors_cleanup
, METH_NOARGS
, NULL
},
27 {"sensors_init", (PyCFunction
)_collecty_sensors_init
, METH_NOARGS
, NULL
},
31 static struct PyModuleDef collecty_module
= {
32 PyModuleDef_HEAD_INIT
,
33 "_collecty", /* m_name */
34 "_collecty module", /* m_doc */
36 collecty_module_methods
, /* m_methods */
38 NULL
, /* m_traverse */
43 PyMODINIT_FUNC
PyInit__collecty(void) {
44 if (PyType_Ready(&BlockDeviceType
) < 0)
47 if (PyType_Ready(&PingType
) < 0)
50 if (PyType_Ready(&SensorType
) < 0)
53 PyObject
* m
= PyModule_Create(&collecty_module
);
55 Py_INCREF(&BlockDeviceType
);
56 PyModule_AddObject(m
, "BlockDevice", (PyObject
*)&BlockDeviceType
);
59 PyModule_AddObject(m
, "Ping", (PyObject
*)&PingType
);
61 PyExc_PingError
= PyErr_NewException("_collecty.PingError", NULL
, NULL
);
62 Py_INCREF(PyExc_PingError
);
63 PyModule_AddObject(m
, "PingError", PyExc_PingError
);
65 PyExc_PingAddHostError
= PyErr_NewException("_collecty.PingAddHostError", NULL
, NULL
);
66 Py_INCREF(PyExc_PingAddHostError
);
67 PyModule_AddObject(m
, "PingAddHostError", PyExc_PingAddHostError
);
69 Py_INCREF(&SensorType
);
70 PyModule_AddObject(m
, "Sensor", (PyObject
*)&SensorType
);