Difference between revisions of "Side-by-side GNU Radio Modules"
From SpenchWiki
(Initial steps) |
|||
Line 1: | Line 1: | ||
− | + | == Configure == | |
− | + | With alternate prefix: | |
+ | ./configure --prefix=/usr/local.op25-latest | ||
+ | |||
+ | == Alternate environment == | ||
+ | |||
+ | Set up the sub-environment to favour the side-by-side module: | ||
+ | |||
+ | ~/bin/setenv.op25-latest | ||
+ | |||
+ | <syntaxhighlight lang="bash"> | ||
#!/bin/sh | #!/bin/sh | ||
Line 11: | Line 20: | ||
bash -i | bash -i | ||
+ | </syntaxhighlight> | ||
− | + | Show the sub-environment in the shell prompt: | |
+ | ~/.bashrc | ||
+ | |||
+ | <syntaxhighlight lang="bash"> | ||
if [ -n "$SUBENV" ]; then | if [ -n "$SUBENV" ]; then | ||
PS1="\e[1;31m$SUBENV\e[m $PS1" | PS1="\e[1;31m$SUBENV\e[m $PS1" | ||
fi | fi | ||
+ | </syntaxhighlight> | ||
− | + | == Python sitecustomize == | |
− | |||
− | |||
+ | Inject side-by-side module in ''gnuradio'' namespace (sitecustomize is automatically included by interpreter): | ||
+ | |||
+ | Override original op25 in gnuradio, because: | ||
+ | <syntaxhighlight lang="python"> | ||
+ | from gnuradio import op25 | ||
+ | </syntaxhighlight> | ||
+ | would return original op25 installation | ||
+ | |||
+ | /usr/local.op25-latest/lib/python2.7/site-packages/sitecustomize.py | ||
+ | |||
+ | <syntaxhighlight lang="python"> | ||
print "Customising for: op25-latest" | print "Customising for: op25-latest" | ||
Line 27: | Line 50: | ||
import gnuradio | import gnuradio | ||
gnuradio.op25 = op25 | gnuradio.op25 = op25 | ||
+ | </syntaxhighlight> | ||
Could also: | Could also: | ||
+ | |||
+ | <syntaxhighlight lang="python"> | ||
from gnuradio import op25 as op25_original | from gnuradio import op25 as op25_original | ||
... | ... | ||
gnuradio.op25_original = op25_original | gnuradio.op25_original = op25_original | ||
+ | </syntaxhighlight> |
Revision as of 18:54, 5 November 2012
Configure
With alternate prefix:
./configure --prefix=/usr/local.op25-latest
Alternate environment
Set up the sub-environment to favour the side-by-side module:
~/bin/setenv.op25-latest
#!/bin/sh
LD_LIBRARY_PATH=/usr/local.op25-latest/lib:$LD_LIBRARY_PATH
PYTHONPATH=/usr/local.op25-latest/lib/python2.7/site-packages/gnuradio:/usr/local.op25-latest/lib/python2.7/site-packages:$PYTHON_PATH
# 'export' is necessary
export SUBENV="op25-latest"
bash -i
Show the sub-environment in the shell prompt:
~/.bashrc
if [ -n "$SUBENV" ]; then
PS1="\e[1;31m$SUBENV\e[m $PS1"
fi
Python sitecustomize
Inject side-by-side module in gnuradio namespace (sitecustomize is automatically included by interpreter):
Override original op25 in gnuradio, because:
from gnuradio import op25
would return original op25 installation
/usr/local.op25-latest/lib/python2.7/site-packages/sitecustomize.py
print "Customising for: op25-latest"
import op25
import gnuradio
gnuradio.op25 = op25
Could also:
from gnuradio import op25 as op25_original
...
gnuradio.op25_original = op25_original