From 42ff61b3a09f5989b66f49c7fe8c70161d6d8ac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Skog=C3=B8=20Langvand?= Date: Sun, 9 Feb 2020 15:15:43 +0100 Subject: [PATCH 1/4] Make required python-dev packages mandatory --- wscript | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wscript b/wscript index c09e1b64a..ddaa8ef7b 100644 --- a/wscript +++ b/wscript @@ -153,10 +153,10 @@ def configure(ctx): # Add Python bindings if ctx.options.enable_bindings: ctx.env.LIBCSP_PYTHON2 = ctx.check_cfg(package='python2', args='--cflags --libs', atleast_version='2.7', - mandatory=False) + mandatory=True) if ctx.options.enable_python3_bindings: ctx.env.LIBCSP_PYTHON3 = ctx.check_cfg(package='python3', args='--cflags --libs', atleast_version='3.5', - mandatory=False) + mandatory=True) # Set defines for enabling features ctx.define('CSP_DEBUG', not ctx.options.disable_output) From 411083e8115181bb2380365df290d67faf6d4e56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Skog=C3=B8=20Langvand?= Date: Sun, 9 Feb 2020 15:16:42 +0100 Subject: [PATCH 2/4] Make python3 bindings independent of python2 bindings; rename python_bindings to python2_bindings for clarity --- wscript | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/wscript b/wscript index ddaa8ef7b..eae4cbbe8 100644 --- a/wscript +++ b/wscript @@ -48,7 +48,7 @@ def options(ctx): gr.add_option('--enable-crc32', action='store_true', help='Enable CRC32 support') gr.add_option('--enable-hmac', action='store_true', help='Enable HMAC-SHA1 support') gr.add_option('--enable-xtea', action='store_true', help='Enable XTEA support') - gr.add_option('--enable-bindings', action='store_true', help='Enable Python bindings') + gr.add_option('--enable-python2-bindings', action='store_true', help='Enable Python2 bindings') gr.add_option('--enable-python3-bindings', action='store_true', help='Enable Python3 bindings') gr.add_option('--enable-examples', action='store_true', help='Enable examples') gr.add_option('--enable-dedup', action='store_true', help='Enable packet deduplicator') @@ -151,12 +151,12 @@ def configure(ctx): ctx.env.ENABLE_EXAMPLES = ctx.options.enable_examples # Add Python bindings - if ctx.options.enable_bindings: + if ctx.options.enable_python2_bindings: ctx.env.LIBCSP_PYTHON2 = ctx.check_cfg(package='python2', args='--cflags --libs', atleast_version='2.7', mandatory=True) - if ctx.options.enable_python3_bindings: - ctx.env.LIBCSP_PYTHON3 = ctx.check_cfg(package='python3', args='--cflags --libs', atleast_version='3.5', - mandatory=True) + if ctx.options.enable_python3_bindings: + ctx.env.LIBCSP_PYTHON3 = ctx.check_cfg(package='python3', args='--cflags --libs', atleast_version='3.5', + mandatory=True) # Set defines for enabling features ctx.define('CSP_DEBUG', not ctx.options.disable_output) From f2a484a3912e84f9c6127816ff4b3eeb69b9c325 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Skog=C3=B8=20Langvand?= Date: Sun, 9 Feb 2020 15:27:48 +0100 Subject: [PATCH 3/4] Update for new wscript --- examples/buildall.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/buildall.py b/examples/buildall.py index c48e5df4d..4935d58ce 100755 --- a/examples/buildall.py +++ b/examples/buildall.py @@ -26,7 +26,7 @@ waf = ['./waf'] if os in ['posix']: options += [ - '--enable-bindings', + '--enable-python2-bindings', '--enable-python3-bindings', '--enable-can-socketcan', '--with-driver-usart=linux', From 0917cb76c3b4d5470f4bd47421b3e4acba8f7b5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Skog=C3=B8=20Langvand?= Date: Sun, 9 Feb 2020 15:28:07 +0100 Subject: [PATCH 4/4] Updated examples --- examples/python_bindings_example_client.py | 3 +-- examples/python_bindings_example_server.py | 8 +------- 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/examples/python_bindings_example_client.py b/examples/python_bindings_example_client.py index 9ecd2296e..8c1787784 100644 --- a/examples/python_bindings_example_client.py +++ b/examples/python_bindings_example_client.py @@ -15,8 +15,7 @@ if __name__ == "__main__": - csp.buffer_init(10, 300) - csp.init(28) + csp.init(28,"test_service","bindings","1.2.3",10,300) csp.zmqhub_init(28, "localhost") csp.rtable_set(27, 5, "ZMQHUB") csp.route_start_task() diff --git a/examples/python_bindings_example_server.py b/examples/python_bindings_example_server.py index ab333da4f..19902b1fe 100644 --- a/examples/python_bindings_example_server.py +++ b/examples/python_bindings_example_server.py @@ -20,17 +20,11 @@ zmqp = subprocess.Popen('build/zmqproxy') # init csp - csp.buffer_init(10, 300) - csp.init(27) + csp.init(27,"test_service","bindings","1.2.3",10,300) csp.zmqhub_init(27, "localhost") csp.rtable_set(28, 5, "ZMQHUB") csp.route_start_task() - # set identity - csp.set_hostname("test_service") - csp.set_model("bindings") - csp.set_revision("1.2.3") - # and read it back print (csp.get_hostname()) print (csp.get_model())