summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/python/gnuradio/gr
diff options
context:
space:
mode:
Diffstat (limited to 'gnuradio-runtime/python/gnuradio/gr')
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt14
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/__init__.py13
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/tag_utils.py7
3 files changed, 24 insertions, 10 deletions
diff --git a/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt b/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt
index 2be4d4a0f3..7f9c19500b 100644
--- a/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt
+++ b/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt
@@ -38,10 +38,16 @@ GR_PYTHON_INSTALL(FILES
# Handle the unit tests
########################################################################
if(ENABLE_TESTING)
-include(GrTest)
-file(GLOB py_qa_test_files "qa_*.py")
-foreach(py_qa_test_file ${py_qa_test_files})
+ set(GR_TEST_TARGET_DEPS "")
+ set(GR_TEST_LIBRARY_DIRS "")
+ set(GR_TEST_PYTHON_DIRS
+ ${CMAKE_BINARY_DIR}/gruel/src/python
+ ${CMAKE_BINARY_DIR}/gnuradio-core/src/python
+ )
+ include(GrTest)
+ file(GLOB py_qa_test_files "qa_*.py")
+ foreach(py_qa_test_file ${py_qa_test_files})
get_filename_component(py_qa_test_name ${py_qa_test_file} NAME_WE)
GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file})
-endforeach(py_qa_test_file)
+ endforeach(py_qa_test_file)
endif(ENABLE_TESTING)
diff --git a/gnuradio-runtime/python/gnuradio/gr/__init__.py b/gnuradio-runtime/python/gnuradio/gr/__init__.py
index 20a8f97f63..94a5c9ec2b 100644
--- a/gnuradio-runtime/python/gnuradio/gr/__init__.py
+++ b/gnuradio-runtime/python/gnuradio/gr/__init__.py
@@ -28,7 +28,18 @@ Core contents.
# This is the main GNU Radio python module.
# We pull the swig output and the other modules into the gnuradio.gr namespace
-from runtime_swig import *
+# If gnuradio is installed then the swig output will be in this directory.
+# Otherwise it will reside in ../../../swig.
+
+import os
+
+try:
+ from runtime_swig import *
+except ImportError:
+ dirname, filename = os.path.split(os.path.abspath(__file__))
+ __path__.append(os.path.join(dirname, "..", "..", "..", "swig"))
+ from runtime_swig import *
+
from exceptions import *
from top_block import *
from hier_block2 import *
diff --git a/gnuradio-runtime/python/gnuradio/gr/tag_utils.py b/gnuradio-runtime/python/gnuradio/gr/tag_utils.py
index e35564c1eb..c25ed8d772 100644
--- a/gnuradio-runtime/python/gnuradio/gr/tag_utils.py
+++ b/gnuradio-runtime/python/gnuradio/gr/tag_utils.py
@@ -22,10 +22,7 @@
import pmt
-try:
- from gnuradio import gr
-except ImportError:
- from runtime_swig import tag_t
+from gnuradio import gr
class PythonTag(object):
" Python container for tags "
@@ -46,7 +43,7 @@ def tag_to_python(tag):
def tag_to_pmt(tag):
""" Convert a Python-readable object to a stream tag """
- newtag = tag_t()
+ newtag = gr.tag_t()
newtag.offset = tag.offset
newtag.key = pmt.to_python(tag.key)
newtag.value = pmt.from_python(tag.value)