summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config/grc_grc.m411
-rw-r--r--grc/Makefile.am1
-rw-r--r--grc/grc.conf.in1
-rw-r--r--grc/python/Constants.py6
-rw-r--r--grc/python/Generator.py20
5 files changed, 17 insertions, 22 deletions
diff --git a/config/grc_grc.m4 b/config/grc_grc.m4
index c21acccff..0474c4e89 100644
--- a/config/grc_grc.m4
+++ b/config/grc_grc.m4
@@ -34,17 +34,6 @@ AC_DEFUN([GRC_GRC],[
PYTHON_CHECK_MODULE([numpy],[NumPy],[],[passed=no],[True])
fi
- dnl ########################################
- dnl # platform dependency pythonw
- dnl ########################################
- dnl FIXME: move this test to Python config m4
- if test `${PYTHON} -c "import sys; print sys.platform"` = 'darwin'; then
- PYTHONW=pythonw
- else
- PYTHONW=python
- fi
- AC_SUBST(PYTHONW)
-
AC_CONFIG_FILES([ \
grc/Makefile \
grc/base/Makefile \
diff --git a/grc/Makefile.am b/grc/Makefile.am
index c36786281..9d473b4d3 100644
--- a/grc/Makefile.am
+++ b/grc/Makefile.am
@@ -43,7 +43,6 @@ BUILT_SOURCES += grc.conf
grc.conf: $(srcdir)/grc.conf.in Makefile
sed \
- -e 's|@pythonw[@]|$(PYTHONW)|g' \
-e 's|@blocksdir[@]|$(grc_blocksdir)|g' \
-e 's|@docdir[@]|$(gr_docdir)|g' \
$< > $@
diff --git a/grc/grc.conf.in b/grc/grc.conf.in
index 37a049971..9363ca981 100644
--- a/grc/grc.conf.in
+++ b/grc/grc.conf.in
@@ -3,7 +3,6 @@
# ~/.gnuradio/config.conf
[grc]
-pythonw = @pythonw@
doc_dir = @docdir@
global_blocks_path = @blocksdir@
local_blocks_path =
diff --git a/grc/python/Constants.py b/grc/python/Constants.py
index e661c3927..868c822aa 100644
--- a/grc/python/Constants.py
+++ b/grc/python/Constants.py
@@ -1,5 +1,5 @@
"""
-Copyright 2008, 2009 Free Software Foundation, Inc.
+Copyright 2008-2011 Free Software Foundation, Inc.
This file is part of GNU Radio
GNU Radio Companion is free software; you can redistribute it and/or
@@ -23,10 +23,8 @@ from gnuradio import gr
_gr_prefs = gr.prefs()
-PYEXEC = os.environ.get('PYTHONW', _gr_prefs.get_string('grc', 'pythonw', ''))
-
#setup paths
-PATH_SEP = ':'
+PATH_SEP = {'/':':', '\\':';'}[os.path.sep]
DOCS_DIR = os.environ.get('GR_DOC_DIR', _gr_prefs.get_string('grc', 'doc_dir', ''))
HIER_BLOCKS_LIB_DIR = os.path.join(os.path.expanduser('~'), '.grc_gnuradio')
BLOCKS_DIRS = filter( #filter blank strings
diff --git a/grc/python/Generator.py b/grc/python/Generator.py
index b669fa65a..b31f0a009 100644
--- a/grc/python/Generator.py
+++ b/grc/python/Generator.py
@@ -18,14 +18,14 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
"""
import os
+import sys
import subprocess
import tempfile
from Cheetah.Template import Template
import expr_utils
from Constants import \
TOP_BLOCK_FILE_MODE, HIER_BLOCK_FILE_MODE, \
- HIER_BLOCKS_LIB_DIR, PYEXEC, \
- FLOW_GRAPH_TEMPLATE
+ HIER_BLOCKS_LIB_DIR, FLOW_GRAPH_TEMPLATE
import convert_hier
from .. gui import Messages
@@ -74,10 +74,20 @@ Add a Misc->Throttle block to your flow graph to avoid CPU congestion.''')
Execute this python flow graph.
@return a popen object
"""
- #execute
- cmds = [PYEXEC, '-u', self.get_file_path()] #-u is unbuffered stdio
- if self._generate_options == 'no_gui':
+ #extract the path to the python executable
+ python_exe = sys.executable
+
+ #when using wx gui on mac os, execute with pythonw
+ if self._generate_options == 'wx_gui' and 'darwin' in sys.platform.lower():
+ python_exe += 'w'
+
+ #setup the command args to run
+ cmds = [python_exe, '-u', self.get_file_path()] #-u is unbuffered stdio
+
+ #when in no gui mode on linux, use an xterm (looks nice)
+ if self._generate_options == 'no_gui' and 'linux' in sys.platform.lower():
cmds = ['xterm', '-e'] + cmds
+
p = subprocess.Popen(args=cmds, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False, universal_newlines=True)
return p