VPP Python language binding - plugin support
- Moved Python generator tool to tools directory
- Added build-vpp-api Makefile target
- Generator now only creates a Python representation of the .api
the rest of the framework is in the vpp_papi script
- Each plugin has its own namespace.
- Plugin Python files are installed in vpp_papi_plugins for easy
use inside the build tree.
Change-Id: I272c83bb7e5d5e416bdbd8a790a3cc35c5a04e38
Signed-off-by: Ole Troan <ot@cisco.com>
diff --git a/vpp-api/python/vpp_papi/pneum_wrap.c b/vpp-api/python/vpp_papi/pneum_wrap.c
index d1795aa..7a51197 100644
--- a/vpp-api/python/vpp_papi/pneum_wrap.c
+++ b/vpp-api/python/vpp_papi/pneum_wrap.c
@@ -1,5 +1,20 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include <Python.h>
-#include "pneum.h"
+#include "../pneum/pneum.h"
static PyObject *pneum_callback = NULL;
@@ -35,7 +50,7 @@
if (!PyArg_ParseTuple(args, "sO:set_callback", &name, &temp))
return (NULL);
-
+
if (!PyCallable_Check(temp)) {
PyErr_SetString(PyExc_TypeError, "parameter must be callable");
return NULL;
@@ -66,8 +81,8 @@
char *data;
int len, rv;
- if (!PyArg_ParseTuple(args, "s#", &data, &len))
- return NULL;
+ if (!PyArg_ParseTuple(args, "s#", &data, &len))
+ return NULL;
Py_BEGIN_ALLOW_THREADS
rv = pneum_write(data, len);
Py_END_ALLOW_THREADS
@@ -117,16 +132,16 @@
{
#if PY_VERSION_HEX >= 0x03000000
static struct PyModuleDef vpp_api_module = {
-# if PY_VERSION_HEX >= 0x03020000
+#if PY_VERSION_HEX >= 0x03020000
PyModuleDef_HEAD_INIT,
-# else
+#else
{
PyObject_HEAD_INIT(NULL)
NULL, /* m_init */
0, /* m_index */
NULL, /* m_copy */
},
-# endif
+#endif
(char *) "vpp_api",
NULL,
-1,