diff options
author | Eric Blossom | 2010-12-27 18:32:24 -0800 |
---|---|---|
committer | Eric Blossom | 2010-12-27 18:32:24 -0800 |
commit | 46c2368192a57fd0bfe9f50f753759736c4b4668 (patch) | |
tree | 71f0dc13a2820a53cda46db44eedc817a190f0ea | |
parent | 440b0e3bdd81282a83805693c8eb822ee6815f72 (diff) | |
download | gnuradio-46c2368192a57fd0bfe9f50f753759736c4b4668.tar.gz gnuradio-46c2368192a57fd0bfe9f50f753759736c4b4668.tar.bz2 gnuradio-46c2368192a57fd0bfe9f50f753759736c4b4668.zip |
Rename usrp2.i to usrp2_swig.i to allow insertion of guile convenience functions.
-rw-r--r-- | gr-usrp2/src/.gitignore | 1 | ||||
-rw-r--r-- | gr-usrp2/src/Makefile.am | 29 | ||||
-rw-r--r-- | gr-usrp2/src/Makefile.swig.gen | 98 | ||||
-rw-r--r-- | gr-usrp2/src/__init__.py | 28 | ||||
-rwxr-xr-x | gr-usrp2/src/qa_usrp2.py | 2 | ||||
-rw-r--r-- | gr-usrp2/src/usrp2_swig.i (renamed from gr-usrp2/src/usrp2.i) | 2 |
6 files changed, 96 insertions, 64 deletions
diff --git a/gr-usrp2/src/.gitignore b/gr-usrp2/src/.gitignore index 77ff1d528..e167cdecc 100644 --- a/gr-usrp2/src/.gitignore +++ b/gr-usrp2/src/.gitignore @@ -11,3 +11,4 @@ /gnuradio /guile /python +/usrp2_swig.py diff --git a/gr-usrp2/src/Makefile.am b/gr-usrp2/src/Makefile.am index 8e1d0c20c..e2cca8b3c 100644 --- a/gr-usrp2/src/Makefile.am +++ b/gr-usrp2/src/Makefile.am @@ -27,14 +27,13 @@ EXTRA_DIST += run_tests.in DISTCLEANFILES += run_tests -# ---------------------------------------------------------------------- -# Local Python files, not installed -# -# qa_usrp2.py -# ---------------------------------------------------------------------- - noinst_PYTHON = qa_usrp2.py +if GUILE +nobase_guile_DATA = gnuradio/usrp2.scm +endif + + # ---------------------------------------------------------------------- # Miscellaneous build operations # ---------------------------------------------------------------------- @@ -91,23 +90,27 @@ noinst_HEADERS = \ # ---------------------------------------------------------------------- TOP_SWIG_IFILES = \ - usrp2.i + usrp2_swig.i # Install so that they end up available as: # import gnuradio.usrp2 # This ends up at: -# ${prefix}/lib/python${python_version}/site-packages/gnuradio -usrp2_pythondir_category = \ - gnuradio +# ${prefix}/lib/python${python_version}/site-packages/gnuradio/usrp2 +usrp2_swig_pythondir_category = \ + gnuradio/usrp2 # additional arguments to the SWIG command -usrp2_swig_args = \ +usrp2_swig_swig_args = \ $(USRP2_INCLUDES) # additional libraries for linking with the SWIG-generated library -usrp2_la_swig_libadd = \ +usrp2_swig_la_swig_libadd = \ libgnuradio-usrp2.la +# additional Python files to be installed along with the SWIG-generated one +usrp2_swig_python = \ + __init__.py + if PYTHON TESTS += run_tests -endif
\ No newline at end of file +endif diff --git a/gr-usrp2/src/Makefile.swig.gen b/gr-usrp2/src/Makefile.swig.gen index 73d5b15a8..d791ae2fa 100644 --- a/gr-usrp2/src/Makefile.swig.gen +++ b/gr-usrp2/src/Makefile.swig.gen @@ -20,37 +20,37 @@ # Boston, MA 02110-1301, USA. # -# Makefile.swig.gen for usrp2.i +# Makefile.swig.gen for usrp2_swig.i ## Default install locations for these files: ## ## Default location for the Python directory is: -## ${prefix}/lib/python${python_version}/site-packages/[category]/usrp2 +## ${prefix}/lib/python${python_version}/site-packages/[category]/usrp2_swig ## Default location for the Python exec directory is: -## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/usrp2 +## ${exec_prefix}/lib/python${python_version}/site-packages/[category]/usrp2_swig ## ## The following can be overloaded to change the install location, but ## this has to be done in the including Makefile.am -before- ## Makefile.swig is included. -usrp2_pythondir_category ?= gnuradio/usrp2 -usrp2_pylibdir_category ?= $(usrp2_pythondir_category) -usrp2_pythondir = $(pythondir)/$(usrp2_pythondir_category) -usrp2_pylibdir = $(pyexecdir)/$(usrp2_pylibdir_category) +usrp2_swig_pythondir_category ?= gnuradio/usrp2_swig +usrp2_swig_pylibdir_category ?= $(usrp2_swig_pythondir_category) +usrp2_swig_pythondir = $(pythondir)/$(usrp2_swig_pythondir_category) +usrp2_swig_pylibdir = $(pyexecdir)/$(usrp2_swig_pylibdir_category) # The .so libraries for the guile modules get installed whereever guile # is installed, usually /usr/lib/guile/gnuradio/ # FIXME: determince whether these should be installed with gnuradio. -usrp2_scmlibdir = $(libdir) +usrp2_swig_scmlibdir = $(libdir) # The scm files for the guile modules get installed where ever guile -# is installed, usually /usr/share/guile/site/usrp2 +# is installed, usually /usr/share/guile/site/usrp2_swig # FIXME: determince whether these should be installed with gnuradio. -usrp2_scmdir = $(guiledir) +usrp2_swig_scmdir = $(guiledir) ## SWIG headers are always installed into the same directory. -usrp2_swigincludedir = $(swigincludedir) +usrp2_swig_swigincludedir = $(swigincludedir) ## This is a template file for a "generated" Makefile addition (in ## this case, "Makefile.swig.gen"). By including the top-level @@ -75,70 +75,70 @@ MOSTLYCLEANFILES += $(DEPDIR)/*.S* ## Makefile.am by setting the variable value there, then including ## Makefile.swig . -usrp2_swiginclude_HEADERS = \ - usrp2.i \ - $(usrp2_swiginclude_headers) +usrp2_swig_swiginclude_HEADERS = \ + usrp2_swig.i \ + $(usrp2_swig_swiginclude_headers) if PYTHON -usrp2_pylib_LTLIBRARIES = \ - _usrp2.la +usrp2_swig_pylib_LTLIBRARIES = \ + _usrp2_swig.la -_usrp2_la_SOURCES = \ - python/usrp2.cc \ - $(usrp2_la_swig_sources) +_usrp2_swig_la_SOURCES = \ + python/usrp2_swig.cc \ + $(usrp2_swig_la_swig_sources) -usrp2_python_PYTHON = \ - usrp2.py \ - $(usrp2_python) +usrp2_swig_python_PYTHON = \ + usrp2_swig.py \ + $(usrp2_swig_python) -_usrp2_la_LIBADD = \ +_usrp2_swig_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ - $(usrp2_la_swig_libadd) + $(usrp2_swig_la_swig_libadd) -_usrp2_la_LDFLAGS = \ +_usrp2_swig_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ - $(usrp2_la_swig_ldflags) + $(usrp2_swig_la_swig_ldflags) -_usrp2_la_CXXFLAGS = \ +_usrp2_swig_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ - $(usrp2_la_swig_cxxflags) + $(usrp2_swig_la_swig_cxxflags) -python/usrp2.cc: usrp2.py -usrp2.py: usrp2.i +python/usrp2_swig.cc: usrp2_swig.py +usrp2_swig.py: usrp2_swig.i # Include the python dependencies for this file --include python/usrp2.d +-include python/usrp2_swig.d endif # end of if python if GUILE -usrp2_scmlib_LTLIBRARIES = \ - libguile-gnuradio-usrp2.la -libguile_gnuradio_usrp2_la_SOURCES = \ - guile/usrp2.cc \ - $(usrp2_la_swig_sources) -nobase_usrp2_scm_DATA = \ - gnuradio/usrp2.scm \ - gnuradio/usrp2-primitive.scm -libguile_gnuradio_usrp2_la_LIBADD = \ +usrp2_swig_scmlib_LTLIBRARIES = \ + libguile-gnuradio-usrp2_swig.la +libguile_gnuradio_usrp2_swig_la_SOURCES = \ + guile/usrp2_swig.cc \ + $(usrp2_swig_la_swig_sources) +nobase_usrp2_swig_scm_DATA = \ + gnuradio/usrp2_swig.scm \ + gnuradio/usrp2_swig-primitive.scm +libguile_gnuradio_usrp2_swig_la_LIBADD = \ $(STD_SWIG_LA_LIB_ADD) \ - $(usrp2_la_swig_libadd) -libguile_gnuradio_usrp2_la_LDFLAGS = \ + $(usrp2_swig_la_swig_libadd) +libguile_gnuradio_usrp2_swig_la_LDFLAGS = \ $(STD_SWIG_LA_LD_FLAGS) \ - $(usrp2_la_swig_ldflags) -libguile_gnuradio_usrp2_la_CXXFLAGS = \ + $(usrp2_swig_la_swig_ldflags) +libguile_gnuradio_usrp2_swig_la_CXXFLAGS = \ $(STD_SWIG_CXX_FLAGS) \ -I$(top_builddir) \ - $(usrp2_la_swig_cxxflags) + $(usrp2_swig_la_swig_cxxflags) -guile/usrp2.cc: gnuradio/usrp2.scm -gnuradio/usrp2.scm: usrp2.i -gnuradio/usrp2-primitive.scm: gnuradio/usrp2.scm +guile/usrp2_swig.cc: gnuradio/usrp2_swig.scm +gnuradio/usrp2_swig.scm: usrp2_swig.i +gnuradio/usrp2_swig-primitive.scm: gnuradio/usrp2_swig.scm # Include the guile dependencies for this file --include guile/usrp2.d +-include guile/usrp2_swig.d endif # end of GUILE diff --git a/gr-usrp2/src/__init__.py b/gr-usrp2/src/__init__.py new file mode 100644 index 000000000..fd4289af5 --- /dev/null +++ b/gr-usrp2/src/__init__.py @@ -0,0 +1,28 @@ +# +# Copyright 2008,2010 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. +# + +# The presence of this file turns this directory into a Python package + +# Add SWIG generated code to this namespace +from usrp2_swig import * + +# Add other content from pure-Python modules here + diff --git a/gr-usrp2/src/qa_usrp2.py b/gr-usrp2/src/qa_usrp2.py index cc994b1e9..33e44aeed 100755 --- a/gr-usrp2/src/qa_usrp2.py +++ b/gr-usrp2/src/qa_usrp2.py @@ -21,7 +21,7 @@ # from gnuradio import gr, gr_unittest -import usrp2 +import usrp2_swig class test_usrp2(gr_unittest.TestCase): diff --git a/gr-usrp2/src/usrp2.i b/gr-usrp2/src/usrp2_swig.i index f99eed402..ef598d7d9 100644 --- a/gr-usrp2/src/usrp2.i +++ b/gr-usrp2/src/usrp2_swig.i @@ -353,7 +353,7 @@ usrp2_sink_16sc_sptr.read_gpio = __read_gpio #if SWIGGUILE %scheme %{ -(load-extension-global "libguile-gnuradio-usrp2" "scm_init_gnuradio_usrp2_module") +(load-extension-global "libguile-gnuradio-usrp2_swig" "scm_init_gnuradio_usrp2_swig_module") %} %goops %{ |