
commit
89e225a4d9
4 changed files with 66 additions and 0 deletions
@ -0,0 +1,5 @@ |
|||||
|
syntax: glob |
||||
|
|
||||
|
*.swp |
||||
|
*.o |
||||
|
*.so |
@ -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] |
||||
|
) |
@ -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); |
||||
|
} |
@ -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…
Reference in new issue