Browse Source

initial commit

AllGroupDevicesShowHandshake
Volker Birk 6 years ago
commit
89e225a4d9
4 changed files with 66 additions and 0 deletions
  1. +5
    -0
      .hgignore
  2. +15
    -0
      setup.py
  3. +21
    -0
      src/pEpmodule.cc
  4. +25
    -0
      src/pEpmodule.hh

+ 5
- 0
.hgignore View File

@ -0,0 +1,5 @@
syntax: glob
*.swp
*.o
*.so

+ 15
- 0
setup.py View File

@ -0,0 +1,15 @@
from distutils.core import setup, Extension
module_pEp = Extension('pEp',
sources = ['src/pEpmodule.cc',],
include_dirs = ['/Users/vb/include',],
library_dirs = ['/Users/vb/lib',],
libraries = ['pEpEngine',],
)
setup(
name='pEp Python adapter',
version='1.0',
description='Provides a Python module giving access to pEp engine',
ext_modules=[module_pEp]
)

+ 21
- 0
src/pEpmodule.cc View File

@ -0,0 +1,21 @@
#include "pEpmodule.hh"
#include <pEp/pEpEngine.h>
namespace pEp {
namespace PythonAdapter {
PyObject *about(PyObject *self, PyObject *args)
{
return PyUnicode_FromString(version_string);
}
}
}
PyMODINIT_FUNC PyInit_pEp(void)
{
PEP_SESSION session;
PEP_STATUS status = init(&session);
if (status != PEP_STATUS_OK)
return NULL;
return PyModule_Create(&pEpmodule);
}

+ 25
- 0
src/pEpmodule.hh View File

@ -0,0 +1,25 @@
#include <Python.h>
namespace pEp {
namespace PythonAdapter {
const char *version_string = "p≡p Python adapter version 0.1";
PyObject *about(PyObject *self, PyObject *args);
}
}
static PyMethodDef pEpMethods[] = {
{"about", pEp::PythonAdapter::about, METH_VARARGS, "about p≡p"},
{NULL, NULL, 0, NULL}
};
static struct PyModuleDef pEpmodule = {
PyModuleDef_HEAD_INIT,
"pEp",
NULL,
-1,
pEpMethods
};
PyMODINIT_FUNC PyInit_pEp(void);

Loading…
Cancel
Save