source: neercs/trunk/src/py_module.c @ 4035

Last change on this file since 4035 was 4035, checked in by Jean-Yves Lamoureux, 10 years ago
  • Added 'neercs' python module, with dummy 'version' method
File size: 1.5 KB
Line 
1/*
2 *  neercs        console-based window manager
3 *  Copyright (c) 2009 Jean-Yves Lamoureux <jylam@lnxscene.org>
4 *                All Rights Reserved
5 *
6 *  $Id: py_module.c 3996 2009-11-22 12:41:45Z jylam $
7 *
8 *  This program is free software. It comes without any warranty, to
9 *  the extent permitted by applicable law. You can redistribute it
10 *  and/or modify it under the terms of the Do What The Fuck You Want
11 *  To Public License, Version 2, as published by Sam Hocevar. See
12 *  http://sam.zoy.org/wtfpl/COPYING for more details.
13 */
14
15#include "config.h"
16
17#ifdef USE_PYTHON
18
19#include <Python.h>
20#include "py_module.h"
21
22#include <stdio.h>
23#include <stdlib.h>
24#include <string.h>
25#include <unistd.h>
26
27#include <fcntl.h>
28#include <signal.h>
29#include <sys/ioctl.h>
30#include <sys/socket.h>
31#include <sys/time.h>
32#include <time.h>
33#include <sys/wait.h>
34#include <sys/types.h>
35#include <caca.h>
36
37#include "neercs.h"
38
39
40static PyObject*
41neercs_version(PyObject *self, PyObject *args)
42{
43    if(!PyArg_ParseTuple(args, ":version"))
44        return NULL;
45    return Py_BuildValue("s", PACKAGE_VERSION);
46}
47
48static PyMethodDef NeercsMethods[] = {
49    {"version", neercs_version, METH_VARARGS,
50        "Return the neercs version."},
51    {NULL, NULL, 0, NULL}
52};
53
54static PyModuleDef NeercsModule = {
55    PyModuleDef_HEAD_INIT, "neercs", NULL, -1, NeercsMethods,
56    NULL, NULL, NULL, NULL
57};
58
59PyObject* PyInit_neercs(void)
60{
61    PyObject* o =  PyModule_Create(&NeercsModule);
62    PyImport_AppendInittab("neercs", &PyInit_neercs);
63    return o;
64}
65
66
67
68
69
70#endif
Note: See TracBrowser for help on using the repository browser.