diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2013-12-08 13:29:07 -0800 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2014-04-22 15:07:20 -0700 |
commit | 254b51f46e81ed6ed0f21f026514848cdf73b6be (patch) | |
tree | eebd5a1d8b8af585dd392217eef081e1532d9c35 | |
parent | b25b76e201c0eabbc89a4c8340b71bedc2e4df7c (diff) |
zeromq: first try at enabling Python. Segfaults in SWIG code.
-rw-r--r-- | gr-zeromq/CMakeLists.txt | 2 | ||||
-rw-r--r-- | gr-zeromq/python/zeromq/CMakeLists.txt (renamed from gr-zeromq/python/zmqblocks/CMakeLists.txt) | 4 | ||||
-rw-r--r-- | gr-zeromq/python/zeromq/__init__.py | 36 | ||||
-rw-r--r-- | gr-zeromq/python/zeromq/probe_manager.py (renamed from gr-zeromq/python/zmqblocks/probe_manager.py) | 15 | ||||
-rw-r--r-- | gr-zeromq/python/zeromq/rpc_manager.py (renamed from gr-zeromq/python/zmqblocks/rpc_manager.py) | 12 | ||||
-rw-r--r-- | gr-zeromq/python/zmqblocks/__init__.py | 56 |
6 files changed, 52 insertions, 73 deletions
diff --git a/gr-zeromq/CMakeLists.txt b/gr-zeromq/CMakeLists.txt index ef46b71138..d96b043251 100644 --- a/gr-zeromq/CMakeLists.txt +++ b/gr-zeromq/CMakeLists.txt @@ -89,7 +89,7 @@ add_subdirectory(include/gnuradio/zeromq) add_subdirectory(lib) if(ENABLE_PYTHON) add_subdirectory(swig) -# add_subdirectory(python/zeromq) + add_subdirectory(python/zeromq) # add_subdirectory(grc) # add_subdirectory(examples) endif(ENABLE_PYTHON) diff --git a/gr-zeromq/python/zmqblocks/CMakeLists.txt b/gr-zeromq/python/zeromq/CMakeLists.txt index b3175bcca2..9185682592 100644 --- a/gr-zeromq/python/zmqblocks/CMakeLists.txt +++ b/gr-zeromq/python/zeromq/CMakeLists.txt @@ -33,7 +33,7 @@ GR_PYTHON_INSTALL( __init__.py rpc_manager.py probe_manager.py - DESTINATION ${GR_PYTHON_DIR}/zmqblocks + DESTINATION ${GR_PYTHON_DIR}/gnuradio/zeromq ) ######################################################################## @@ -41,5 +41,5 @@ GR_PYTHON_INSTALL( ######################################################################## include(GrTest) -set(GR_TEST_TARGET_DEPS gnuradio-zmqblocks) +set(GR_TEST_TARGET_DEPS gnuradio-zeromq) set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig) diff --git a/gr-zeromq/python/zeromq/__init__.py b/gr-zeromq/python/zeromq/__init__.py new file mode 100644 index 0000000000..cab4b67640 --- /dev/null +++ b/gr-zeromq/python/zeromq/__init__.py @@ -0,0 +1,36 @@ +# +# Copyright 2013 Free Software Foundation, Inc. +# +# This file is part of GNU Radio +# +# GNU Radio is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# GNU Radio is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Radio; see the file COPYING. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, +# Boston, MA 02110-1301, USA. +# + +''' +Blocks for interfacing with ZeroMQ endpoints. +''' + +import os + +try: + from zeromq_swig import * +except ImportError: + dirname, filename = os.path.split(os.path.abspath(__file__)) + __path__.append(os.path.join(dirname, "..", "..", "swig")) + from zeromq_swig import * + +from probe_manager import probe_manager +from rpc_manager import rpc_manager diff --git a/gr-zeromq/python/zmqblocks/probe_manager.py b/gr-zeromq/python/zeromq/probe_manager.py index a402e622b6..c30e6eaaba 100644 --- a/gr-zeromq/python/zmqblocks/probe_manager.py +++ b/gr-zeromq/python/zeromq/probe_manager.py @@ -1,24 +1,23 @@ # -# Copyright 2013 Institute for Theoretical Information Technology, -# RWTH Aachen University -# -# Authors: Johannes Schmitz <schmitz@ti.rwth-aachen.de> -# +# Copyright 2013 Free Software Foundation, Inc. +# +# This file is part of GNU Radio. +# # This is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this software; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# import zmq import threading diff --git a/gr-zeromq/python/zmqblocks/rpc_manager.py b/gr-zeromq/python/zeromq/rpc_manager.py index 006dbc6945..e50a3d62fb 100644 --- a/gr-zeromq/python/zmqblocks/rpc_manager.py +++ b/gr-zeromq/python/zeromq/rpc_manager.py @@ -1,24 +1,24 @@ -# +# # Copyright 2013 Institute for Theoretical Information Technology, # RWTH Aachen University -# +# # Authors: Johannes Schmitz <schmitz@ti.rwth-aachen.de> -# +# # This is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. -# +# # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -# +# # You should have received a copy of the GNU General Public License # along with this software; see the file COPYING. If not, write to # the Free Software Foundation, Inc., 51 Franklin Street, # Boston, MA 02110-1301, USA. -# +# import zmq import pmt diff --git a/gr-zeromq/python/zmqblocks/__init__.py b/gr-zeromq/python/zmqblocks/__init__.py deleted file mode 100644 index b11d50aea0..0000000000 --- a/gr-zeromq/python/zmqblocks/__init__.py +++ /dev/null @@ -1,56 +0,0 @@ -# -# Copyright 2008,2009 Free Software Foundation, Inc. -# -# This application is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# This application is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# - -# The presence of this file turns this directory into a Python package - -''' -This is the GNU Radio ZMQBLOCKS module. Place your Python package -description here (python/__init__.py). -''' - -# ---------------------------------------------------------------- -# Temporary workaround for ticket:181 (swig+python problem) -import sys -_RTLD_GLOBAL = 0 -try: - from dl import RTLD_GLOBAL as _RTLD_GLOBAL -except ImportError: - try: - from DLFCN import RTLD_GLOBAL as _RTLD_GLOBAL - except ImportError: - pass - -if _RTLD_GLOBAL != 0: - _dlopenflags = sys.getdlopenflags() - sys.setdlopenflags(_dlopenflags|_RTLD_GLOBAL) -# ---------------------------------------------------------------- - - -# import swig generated symbols into the zmqblocks namespace -from zmqblocks_swig import * - -# import any pure python here -from rpc_manager import rpc_manager -from probe_manager import probe_manager -# - -# ---------------------------------------------------------------- -# Tail of workaround -if _RTLD_GLOBAL != 0: - sys.setdlopenflags(_dlopenflags) # Restore original flags -# ---------------------------------------------------------------- |