summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHåkon Vågsether <haakonsv@gmail.com>2017-09-17 23:44:13 +0200
committerHåkon Vågsether <haakonsv@gmail.com>2017-09-18 00:11:09 +0200
commitec5fe3e57f22c7cd47565085651825ed8b0b727f (patch)
tree6892e09703b5ce5c3f76799b30a056d87c017229
parentd82bb0d2ea7cf1d3473fe2b74ed4af180f5a8167 (diff)
Small Python 3 fixes in the Mako Python template
-rw-r--r--grc/core/generator/flow_graph.py.mako12
1 files changed, 10 insertions, 2 deletions
diff --git a/grc/core/generator/flow_graph.py.mako b/grc/core/generator/flow_graph.py.mako
index 484441f00f..60b1f40569 100644
--- a/grc/core/generator/flow_graph.py.mako
+++ b/grc/core/generator/flow_graph.py.mako
@@ -1,5 +1,13 @@
% if not generate_options.startswith('hb'):
+<%
+from sys import version_info
+python_version = version_info.major
+%>\
+% if python_version == 2:
#!/usr/bin/env python2
+% elif python_version == 3:
+#!/usr/bin/env python3
+% endif
% endif
# -*- coding: utf-8 -*-
<%def name="indent(code)">${ '\n '.join(str(code).splitlines()) }</%def>
@@ -27,7 +35,7 @@ if __name__ == '__main__':
x11 = ctypes.cdll.LoadLibrary('libX11.so')
x11.XInitThreads()
except:
- print "Warning: failed to XInitThreads()"
+ print("Warning: failed to XInitThreads()")
% endif
########################################################
@@ -333,7 +341,7 @@ def main(top_block_cls=${class_name}, options=None):
(tb.${m.name}).start()
% endfor
try:
- raw_input('Press Enter to quit: ')
+ input('Press Enter to quit: ')
except EOFError:
pass
tb.stop()