summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gr-howto-write-a-block/python/Makefile.am11
-rw-r--r--gr-howto-write-a-block/python/__init__.py49
-rwxr-xr-xgr-howto-write-a-block/python/qa_howto.py6
-rw-r--r--gr-howto-write-a-block/swig/.gitignore4
-rw-r--r--gr-howto-write-a-block/swig/Makefile.swig.gen22
5 files changed, 71 insertions, 21 deletions
diff --git a/gr-howto-write-a-block/python/Makefile.am b/gr-howto-write-a-block/python/Makefile.am
index 79f44019d..4ef5fc964 100644
--- a/gr-howto-write-a-block/python/Makefile.am
+++ b/gr-howto-write-a-block/python/Makefile.am
@@ -21,12 +21,13 @@
include $(top_srcdir)/Makefile.common
-EXTRA_DIST = run_tests.in
-
+ourpythondir = $(grpythondir)/howto
-TESTS = \
- run_tests
+EXTRA_DIST = run_tests.in
+TESTS = run_tests
+ourpython_PYTHON = \
+ __init__.py
-noinst_PYTHON = \
+noinst_PYTHON = \
qa_howto.py
diff --git a/gr-howto-write-a-block/python/__init__.py b/gr-howto-write-a-block/python/__init__.py
new file mode 100644
index 000000000..3107e1fb9
--- /dev/null
+++ b/gr-howto-write-a-block/python/__init__.py
@@ -0,0 +1,49 @@
+#
+# 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
+
+# ----------------------------------------------------------------
+# 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 trppm namespace
+from howto_swig import *
+
+# import any pure python here
+#
+
+# ----------------------------------------------------------------
+# Tail of workaround
+if _RTLD_GLOBAL != 0:
+ sys.setdlopenflags(_dlopenflags) # Restore original flags
+# ----------------------------------------------------------------
diff --git a/gr-howto-write-a-block/python/qa_howto.py b/gr-howto-write-a-block/python/qa_howto.py
index 0abe0e244..630f57bf4 100755
--- a/gr-howto-write-a-block/python/qa_howto.py
+++ b/gr-howto-write-a-block/python/qa_howto.py
@@ -21,7 +21,7 @@
#
from gnuradio import gr, gr_unittest
-import howto
+import howto_swig
class qa_howto (gr_unittest.TestCase):
@@ -35,7 +35,7 @@ class qa_howto (gr_unittest.TestCase):
src_data = (-3, 4, -5.5, 2, 3)
expected_result = (9, 16, 30.25, 4, 9)
src = gr.vector_source_f (src_data)
- sqr = howto.square_ff ()
+ sqr = howto_swig.square_ff ()
dst = gr.vector_sink_f ()
self.tb.connect (src, sqr)
self.tb.connect (sqr, dst)
@@ -47,7 +47,7 @@ class qa_howto (gr_unittest.TestCase):
src_data = (-3, 4, -5.5, 2, 3)
expected_result = (9, 16, 30.25, 4, 9)
src = gr.vector_source_f (src_data)
- sqr = howto.square2_ff ()
+ sqr = howto_swig.square2_ff ()
dst = gr.vector_sink_f ()
self.tb.connect (src, sqr)
self.tb.connect (sqr, dst)
diff --git a/gr-howto-write-a-block/swig/.gitignore b/gr-howto-write-a-block/swig/.gitignore
index 916527317..7f4c478d9 100644
--- a/gr-howto-write-a-block/swig/.gitignore
+++ b/gr-howto-write-a-block/swig/.gitignore
@@ -2,5 +2,5 @@
/.libs
/Makefile.in
/Makefile
-/howto.cc
-/howto.py
+/howto_swig.cc
+/howto_swig.py
diff --git a/gr-howto-write-a-block/swig/Makefile.swig.gen b/gr-howto-write-a-block/swig/Makefile.swig.gen
index f76cc6371..c62e5aa3e 100644
--- a/gr-howto-write-a-block/swig/Makefile.swig.gen
+++ b/gr-howto-write-a-block/swig/Makefile.swig.gen
@@ -72,42 +72,42 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S*
## .h file is sometimes built, but not always ... so that one has to
## be added manually by the including Makefile.am .
-swig_built_sources += howto.py howto.cc
+swig_built_sources += howto_swig.py howto_swig.cc
## Various SWIG variables. These can be overloaded in the including
## Makefile.am by setting the variable value there, then including
## Makefile.swig .
howto_swiginclude_HEADERS = \
- howto.i \
+ howto.i \
$(howto_swiginclude_headers)
howto_pylib_LTLIBRARIES = \
- _howto.la
+ _howto_swig.la
-_howto_la_SOURCES = \
- howto.cc \
+_howto_swig_la_SOURCES = \
+ howto_swig.cc \
$(howto_la_swig_sources)
-_howto_la_LIBADD = \
+_howto_swig_la_LIBADD = \
$(STD_SWIG_LA_LIB_ADD) \
$(howto_la_swig_libadd)
-_howto_la_LDFLAGS = \
+_howto_swig_la_LDFLAGS = \
$(STD_SWIG_LA_LD_FLAGS) \
$(howto_la_swig_ldflags)
-_howto_la_CXXFLAGS = \
+_howto_swig_la_CXXFLAGS = \
$(STD_SWIG_CXX_FLAGS) \
$(howto_la_swig_cxxflags)
howto_python_PYTHON = \
- howto.py \
+ howto_swig.py \
$(howto_python)
## Entry rule for running SWIG
-howto.h howto.py howto.cc: howto.i
+howto.h howto_swig.py howto_swig.cc: howto.i
## This rule will get called only when MAKE decides that one of the
## targets needs to be created or re-created, because:
##
@@ -202,7 +202,7 @@ $(DEPDIR)/howto-generate-stamp:
##
if $(SWIG) $(STD_SWIG_PYTHON_ARGS) $(howto_swig_args) \
-MD -MF $(DEPDIR)/howto.Std \
- -module howto -o howto.cc $(WHAT); then \
+ -module howto_swig -o howto_swig.cc $(WHAT); then \
if test $(host_os) = mingw32; then \
$(RM) $(DEPDIR)/howto.Sd; \
$(SED) 's,\\\\,/,g' < $(DEPDIR)/howto.Std \