summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Reynwar <ben@reynwar.net>2013-06-03 14:48:01 -0700
committerBen Reynwar <ben@reynwar.net>2013-06-03 14:48:01 -0700
commit2221545bed592dbd0c22f8c5745c9dcfad2f0480 (patch)
treeff2cfc21e281c9005cf916e07c51581e02928473
parent6ee7c1a6267e823d5525d3d5cf251ba52b12c823 (diff)
channels: Setting up channels module for uninstalled import.
-rw-r--r--gnuradio-runtime/python/gnuradio/__init__.py1
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt1
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/__init__.py31
-rw-r--r--gnuradio-runtime/python/gnuradio/gr/tag_utils.py53
-rw-r--r--gr-channels/CMakeLists.txt2
-rw-r--r--gr-channels/python/channels/CMakeLists.txt (renamed from gr-channels/python/CMakeLists.txt)0
-rw-r--r--gr-channels/python/channels/__init__.py (renamed from gr-channels/python/__init__.py)9
-rwxr-xr-xgr-channels/python/channels/qa_channel_model.py (renamed from gr-channels/python/qa_channel_model.py)0
-rw-r--r--gr-channels/python/channels/qa_fading_model.py (renamed from gr-channels/python/qa_fading_model.py)0
-rwxr-xr-xgr-digital/python/digital/qa_packet_headerparser_b.py2
10 files changed, 41 insertions, 58 deletions
diff --git a/gnuradio-runtime/python/gnuradio/__init__.py b/gnuradio-runtime/python/gnuradio/__init__.py
index c0274656d1..6494974fcd 100644
--- a/gnuradio-runtime/python/gnuradio/__init__.py
+++ b/gnuradio-runtime/python/gnuradio/__init__.py
@@ -44,3 +44,4 @@ if path.endswith(path_ending):
__path__.append(os.path.join(build_path, 'gr-vocoder', 'python'))
__path__.append(os.path.join(build_path, 'gr-fcd', 'python'))
__path__.append(os.path.join(build_path, 'gr-comedi', 'python'))
+ __path__.append(os.path.join(build_path, 'gr-channels', 'python'))
diff --git a/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt b/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt
index 7f9c19500b..c29ea5df93 100644
--- a/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt
+++ b/gnuradio-runtime/python/gnuradio/gr/CMakeLists.txt
@@ -27,7 +27,6 @@ GR_PYTHON_INSTALL(FILES
gr_threading_23.py
gr_threading_24.py
hier_block2.py
- tag_utils.py
top_block.py
pubsub.py
DESTINATION ${GR_PYTHON_DIR}/gnuradio/gr
diff --git a/gnuradio-runtime/python/gnuradio/gr/__init__.py b/gnuradio-runtime/python/gnuradio/gr/__init__.py
index 94a5c9ec2b..7ceefb27a5 100644
--- a/gnuradio-runtime/python/gnuradio/gr/__init__.py
+++ b/gnuradio-runtime/python/gnuradio/gr/__init__.py
@@ -43,8 +43,37 @@ except ImportError:
from exceptions import *
from top_block import *
from hier_block2 import *
-from tag_utils import *
+#from tag_utils import *
from gateway import basic_block, sync_block, decim_block, interp_block
# Force the preference database to be initialized
prefs = prefs.singleton
+
+
+class PythonTag(object):
+ " Python container for tags "
+ def __init__(self):
+ self.offset = None
+ self.key = None
+ self.value = None
+ self.srcid = None
+
+def tag_to_python(tag):
+ """ Convert a stream tag to a Python-readable object """
+ newtag = PythonTag()
+ newtag.offset = tag.offset
+ newtag.key = pmt.to_python(tag.key)
+ newtag.value = pmt.to_python(tag.value)
+ newtag.srcid = pmt.to_python(tag.srcid)
+ return newtag
+
+def tag_to_pmt(tag):
+ """ Convert a Python-readable object to a stream tag """
+ newtag = gr.tag_t()
+ newtag.offset = tag.offset
+ newtag.key = pmt.to_python(tag.key)
+ newtag.value = pmt.from_python(tag.value)
+ newtag.srcid = pmt.from_python(tag.srcid)
+ return newtag
+
+
diff --git a/gnuradio-runtime/python/gnuradio/gr/tag_utils.py b/gnuradio-runtime/python/gnuradio/gr/tag_utils.py
deleted file mode 100644
index c25ed8d772..0000000000
--- a/gnuradio-runtime/python/gnuradio/gr/tag_utils.py
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# Copyright 2003-2012 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.
-#
-""" Conversion tools between stream tags and Python objects """
-
-import pmt
-
-from gnuradio import gr
-
-class PythonTag(object):
- " Python container for tags "
- def __init__(self):
- self.offset = None
- self.key = None
- self.value = None
- self.srcid = None
-
-def tag_to_python(tag):
- """ Convert a stream tag to a Python-readable object """
- newtag = PythonTag()
- newtag.offset = tag.offset
- newtag.key = pmt.to_python(tag.key)
- newtag.value = pmt.to_python(tag.value)
- newtag.srcid = pmt.to_python(tag.srcid)
- return newtag
-
-def tag_to_pmt(tag):
- """ Convert a Python-readable object to a stream tag """
- newtag = gr.tag_t()
- newtag.offset = tag.offset
- newtag.key = pmt.to_python(tag.key)
- newtag.value = pmt.from_python(tag.value)
- newtag.srcid = pmt.from_python(tag.srcid)
- return newtag
-
-
diff --git a/gr-channels/CMakeLists.txt b/gr-channels/CMakeLists.txt
index b7df5deee7..f8e46fd207 100644
--- a/gr-channels/CMakeLists.txt
+++ b/gr-channels/CMakeLists.txt
@@ -88,7 +88,7 @@ add_subdirectory(include/gnuradio/channels)
add_subdirectory(lib)
if(ENABLE_PYTHON)
add_subdirectory(swig)
- add_subdirectory(python)
+ add_subdirectory(python/channels)
add_subdirectory(grc)
endif(ENABLE_PYTHON)
#add_subdirectory(examples)
diff --git a/gr-channels/python/CMakeLists.txt b/gr-channels/python/channels/CMakeLists.txt
index 92fe0ef220..92fe0ef220 100644
--- a/gr-channels/python/CMakeLists.txt
+++ b/gr-channels/python/channels/CMakeLists.txt
diff --git a/gr-channels/python/__init__.py b/gr-channels/python/channels/__init__.py
index 0f0efded66..c4d3271f28 100644
--- a/gr-channels/python/__init__.py
+++ b/gr-channels/python/channels/__init__.py
@@ -23,4 +23,11 @@
Blocks for channel models and related functions.
'''
-from channels_swig import *
+import os
+
+try:
+ from channels_swig import *
+except ImportError:
+ dirname, filename = os.path.split(os.path.abspath(__file__))
+ __path__.append(os.path.join(dirname, "..", "..", "swig"))
+ from channels_swig import *
diff --git a/gr-channels/python/qa_channel_model.py b/gr-channels/python/channels/qa_channel_model.py
index 473650f1d7..473650f1d7 100755
--- a/gr-channels/python/qa_channel_model.py
+++ b/gr-channels/python/channels/qa_channel_model.py
diff --git a/gr-channels/python/qa_fading_model.py b/gr-channels/python/channels/qa_fading_model.py
index 5ad378075a..5ad378075a 100644
--- a/gr-channels/python/qa_fading_model.py
+++ b/gr-channels/python/channels/qa_fading_model.py
diff --git a/gr-digital/python/digital/qa_packet_headerparser_b.py b/gr-digital/python/digital/qa_packet_headerparser_b.py
index 2dca3637e3..abd23c8945 100755
--- a/gr-digital/python/digital/qa_packet_headerparser_b.py
+++ b/gr-digital/python/digital/qa_packet_headerparser_b.py
@@ -23,7 +23,7 @@ import time
import random
from gnuradio import gr, gr_unittest, blocks, digital
-from gnuradio.digital import tagged_streams
+from gnuradio.digital.utils import tagged_streams
import pmt
class qa_packet_headerparser_b (gr_unittest.TestCase):