From c575dc1392e6495b1d7ca30476bae86fec0cb8d0 Mon Sep 17 00:00:00 2001 From: Thomas Nagy Date: Tue, 2 Oct 2012 03:46:52 +0200 Subject: [PATCH] Removed the hard-coded python3 syntax to raise meaningful exceptions --- wscript | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/wscript b/wscript index 3605be88..29cb7ccc 100644 --- a/wscript +++ b/wscript @@ -51,6 +51,11 @@ def sub_file(fname, lst): finally: f.close() +def to_bytes(x): + if sys.hexversion>0x300000f: + return x.encode() + return x + print("------> Executing code from the top-level wscript <-----") def init(ctx): if Options.options.setver: # maintainer only (ita) @@ -333,9 +338,9 @@ def create_waf(*k, **kw): f = open('waf', 'wb') try: f.write(ccc.encode()) - f.write(b'#==>\n#') + f.write(to_bytes('#==>\n#')) f.write(cnt) - f.write(b'\n#<==\n') + f.write(to_bytes('\n#<==\n')) finally: f.close()