ucimodule.c 1.23 KB
Newer Older
Karel Koci's avatar
Karel Koci committed
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
/*
 * Copyright 2018, CZ.NIC z.s.p.o. (http://www.nic.cz/)
 *
 * This file is part of the PyUCI.
 *
 * PyUCI is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 * PyUCI is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with PyUCI.  If not, see <http://www.gnu.org/licenses/>.
 */
#include <Python.h>
#include "pyuci.h"

// TODO what about doing uci.get (non-object function)

static PyMethodDef module_methods[] = {
	{NULL, NULL, 0, NULL}
};

static struct PyModuleDef moduledef = {
	PyModuleDef_HEAD_INIT,
	"uci",
	"Unified configuration interface bindings",
	-1,
	module_methods,
	NULL, NULL, NULL, NULL
};


PyMODINIT_FUNC PyInit_uci(void) {
	PyObject *m;

	m = PyModule_Create(&moduledef);
	if (m == NULL)
Karel Koci's avatar
Karel Koci committed
43
		return NULL;
Karel Koci's avatar
Karel Koci committed
44 45 46

	// Add Uci type to module
	if (!pyuci_object_init(m))
Karel Koci's avatar
Karel Koci committed
47
		return NULL;
Karel Koci's avatar
Karel Koci committed
48 49 50

	return m;
}