summaryrefslogtreecommitdiff
path: root/grc/python/Generator.py
diff options
context:
space:
mode:
authorTom Rondeau2011-05-02 12:35:16 +0100
committerTom Rondeau2011-05-02 12:35:16 +0100
commit207a2ae73bd5d6cab201bb57ed8db64fd54cfd90 (patch)
tree3a828f115fdf011b7f78e45d75c45b7c4912a046 /grc/python/Generator.py
parent7a91b8226f71d75b027beb466f965bbba97c07a8 (diff)
parenta92cb89b5529728d9fce781aff85916b3879fbdd (diff)
downloadgnuradio-207a2ae73bd5d6cab201bb57ed8db64fd54cfd90.tar.gz
gnuradio-207a2ae73bd5d6cab201bb57ed8db64fd54cfd90.tar.bz2
gnuradio-207a2ae73bd5d6cab201bb57ed8db64fd54cfd90.zip
Merge branch 'mergeme/grc/cross_platform_work'
Diffstat (limited to 'grc/python/Generator.py')
-rw-r--r--grc/python/Generator.py20
1 files changed, 15 insertions, 5 deletions
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