[PATCH 2/3] add python module for generic netlink library

Arend van Spriel arend at broadcom.com
Mon Jul 15 06:09:12 EDT 2013


This commit adds creation of the netlink.genl package. The actual
capi.i will be filled in upcoming commits so the module is rather
dumb for now.

Signed-off-by: Arend van Spriel <arend at broadcom.com>
---
 configure.ac                    |    1 +
 python/netlink/Makefile.am      |    2 +-
 python/netlink/genl/Makefile.am |    5 +++++
 python/netlink/genl/capi.i      |   11 +++++++++++
 python/setup.py.in              |   13 ++++++++++---
 5 files changed, 28 insertions(+), 4 deletions(-)
 create mode 100644 python/netlink/genl/Makefile.am
 create mode 100644 python/netlink/genl/__init__.py
 create mode 100644 python/netlink/genl/capi.i

diff --git a/configure.ac b/configure.ac
index 34e8c9f..46b216b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -132,6 +132,7 @@ man/Makefile
 python/Makefile
 python/setup.py
 python/netlink/Makefile
+python/netlink/genl/Makefile
 python/netlink/route/Makefile
 include/netlink/version.h
 ])
diff --git a/python/netlink/Makefile.am b/python/netlink/Makefile.am
index 0f1045b..246fbf6 100644
--- a/python/netlink/Makefile.am
+++ b/python/netlink/Makefile.am
@@ -1,6 +1,6 @@
 # -*- Makefile -*-
 
-SUBDIRS = route
+SUBDIRS = route genl
 
 EXTRA_DIST = \
 	capi.i \
diff --git a/python/netlink/genl/Makefile.am b/python/netlink/genl/Makefile.am
new file mode 100644
index 0000000..9e30904
--- /dev/null
+++ b/python/netlink/genl/Makefile.am
@@ -0,0 +1,5 @@
+# -*- Makefile -*-
+
+EXTRA_DIST = \
+	capi.i \
+	__init__.py
diff --git a/python/netlink/genl/__init__.py b/python/netlink/genl/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/python/netlink/genl/capi.i b/python/netlink/genl/capi.i
new file mode 100644
index 0000000..229184b
--- /dev/null
+++ b/python/netlink/genl/capi.i
@@ -0,0 +1,11 @@
+%module capi
+%{
+#include <netlink/genl/ctrl.h>
+#include <netlink/genl/family.h>
+#include <netlink/genl/genl.h>
+#include <netlink/genl/mngt.h>
+%}
+
+%include <stdint.i>
+%include <cstring.i>
+
diff --git a/python/setup.py.in b/python/setup.py.in
index 7ba90d7..813dfc9 100644
--- a/python/setup.py.in
+++ b/python/setup.py.in
@@ -19,12 +19,19 @@ route_capi = Extension('netlink/route/_capi',
 			 libraries = ['nl-3', 'nl-route-3'],
 			)
 
+genl_capi = Extension('netlink/genl/_capi',
+			 sources = ['netlink/genl/capi.i'],
+			 include_dirs = include,
+			 swig_opts = opts,
+			 libraries = ['nl-3', 'nl-genl-3'],
+			)
+
 setup(name = 'netlink',
       version = '1.0',
       description = 'Python wrapper for netlink protocols',
       author = 'Thomas Graf',
       author_email = 'tgraf at suug.ch',
-      ext_modules = [netlink_capi, route_capi],
-      packages = ['netlink', 'netlink.route', 'netlink.route.links',
-      		  'netlink.route.qdisc'],
+      ext_modules = [netlink_capi, route_capi, genl_capi],
+      packages = ['netlink', 'netlink.genl', 'netlink.route',
+		  'netlink.route.links', 'netlink.route.qdisc'],
      )
-- 
1.7.10.4





More information about the libnl mailing list