diff options
author | Ben Reynwar <ben@reynwar.net> | 2013-03-10 20:18:06 -0700 |
---|---|---|
committer | Ben Reynwar <ben@reynwar.net> | 2013-03-10 20:21:29 -0700 |
commit | 2b918e2536aab4a55cc2901cd3082ffb736181d6 (patch) | |
tree | a4c08d042d6fc50c416bd65e8725b703fc9b2c4d /gruel | |
parent | 2405dbb72fdf56ee4e7585e7109fb7c057e2a2f0 (diff) |
gruel: Enabling uninstalled python imports.
Diffstat (limited to 'gruel')
-rw-r--r-- | gruel/CMakeLists.txt | 3 | ||||
-rw-r--r-- | gruel/src/python/gruel/CMakeLists.txt (renamed from gruel/src/python/CMakeLists.txt) | 7 | ||||
-rw-r--r-- | gruel/src/python/gruel/__init__.py (renamed from gruel/src/python/__init__.py) | 0 | ||||
-rw-r--r-- | gruel/src/python/pmt/CMakeLists.txt | 48 | ||||
-rw-r--r-- | gruel/src/python/pmt/__init__.py | 10 | ||||
-rwxr-xr-x | gruel/src/python/pmt/qa_pmt.py (renamed from gruel/src/python/qa_pmt.py) | 0 | ||||
-rwxr-xr-x | gruel/src/python/pmt/qa_pmt_to_python.py (renamed from gruel/src/python/qa_pmt_to_python.py) | 0 |
7 files changed, 59 insertions, 9 deletions
diff --git a/gruel/CMakeLists.txt b/gruel/CMakeLists.txt index 627135abe9..f83c0fbdff 100644 --- a/gruel/CMakeLists.txt +++ b/gruel/CMakeLists.txt @@ -83,7 +83,8 @@ add_subdirectory(src/include/gruel) add_subdirectory(src/lib) if(ENABLE_PYTHON) add_subdirectory(src/swig) - add_subdirectory(src/python) + add_subdirectory(src/python/pmt) + add_subdirectory(src/python/gruel) endif(ENABLE_PYTHON) ######################################################################## diff --git a/gruel/src/python/CMakeLists.txt b/gruel/src/python/gruel/CMakeLists.txt index ba8e8d68a9..1c01df3c68 100644 --- a/gruel/src/python/CMakeLists.txt +++ b/gruel/src/python/gruel/CMakeLists.txt @@ -28,13 +28,6 @@ GR_PYTHON_INSTALL( COMPONENT "gruel_python" ) -GR_PYTHON_INSTALL(FILES - pmt/__init__.py - pmt/pmt_to_python.py - DESTINATION ${GR_PYTHON_DIR}/pmt - COMPONENT "gruel_python" -) - ######################################################################## # Setup unit tests ######################################################################## diff --git a/gruel/src/python/__init__.py b/gruel/src/python/gruel/__init__.py index 976b2ed1ec..976b2ed1ec 100644 --- a/gruel/src/python/__init__.py +++ b/gruel/src/python/gruel/__init__.py diff --git a/gruel/src/python/pmt/CMakeLists.txt b/gruel/src/python/pmt/CMakeLists.txt new file mode 100644 index 0000000000..1d99d1fe29 --- /dev/null +++ b/gruel/src/python/pmt/CMakeLists.txt @@ -0,0 +1,48 @@ +# Copyright 2011 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. + +include(GrPython) + +######################################################################## +# Install python files +######################################################################## +GR_PYTHON_INSTALL(FILES + __init__.py + pmt_to_python.py + DESTINATION ${GR_PYTHON_DIR}/pmt + COMPONENT "gruel_python" +) + +######################################################################## +# Setup unit tests +######################################################################## +if(ENABLE_TESTING) +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) + set(GR_TEST_PYTHON_DIRS + ${CMAKE_BINARY_DIR}/gruel/src/python + ${CMAKE_BINARY_DIR}/gruel/src/swig + ) + set(GR_TEST_TARGET_DEPS gruel gnuradio-core) + ) + GR_ADD_TEST(${py_qa_test_name} ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} ${py_qa_test_file}) +endforeach(py_qa_test_file) +endif(ENABLE_TESTING) diff --git a/gruel/src/python/pmt/__init__.py b/gruel/src/python/pmt/__init__.py index bc933e80a5..0d995c24a4 100644 --- a/gruel/src/python/pmt/__init__.py +++ b/gruel/src/python/pmt/__init__.py @@ -25,7 +25,15 @@ The GNU Radio Utility Etcetera Library's Polymorphic Types for Python. ''' -from pmt_swig import * +import os + +try: + from pmt_swig import * +except ImportError: + dirname, filename = os.path.split(os.path.abspath(__file__)) + __path__.append(os.path.join(dirname, "..", "..", "swig")) + from pmt_swig import * + from pmt_to_python import pmt_to_python as to_python from pmt_to_python import python_to_pmt as to_pmt diff --git a/gruel/src/python/qa_pmt.py b/gruel/src/python/pmt/qa_pmt.py index c8d3df93b2..c8d3df93b2 100755 --- a/gruel/src/python/qa_pmt.py +++ b/gruel/src/python/pmt/qa_pmt.py diff --git a/gruel/src/python/qa_pmt_to_python.py b/gruel/src/python/pmt/qa_pmt_to_python.py index 71aa9000ea..71aa9000ea 100755 --- a/gruel/src/python/qa_pmt_to_python.py +++ b/gruel/src/python/pmt/qa_pmt_to_python.py |