From 40fc2d22bb6ad014763a2a1815b2d6ae29af292b Mon Sep 17 00:00:00 2001 From: Tom Henderson Date: Mon, 12 Aug 2019 16:59:40 -0700 Subject: [PATCH] build: Make wscript changes to default to Python 3 --- wscript | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/wscript b/wscript index 9405e0e5aa2..4122cb96bc5 100644 --- a/wscript +++ b/wscript @@ -368,6 +368,15 @@ def configure(conf): env = conf.env + # ns-3 now only supports Python3 but Waf is based on Python2 + # This can be removed once Waf moves to Python3 + if Options.options.with_python is None: + if sys.version_info < (3,): + # Forcing otherwise unused Options.options.python to select python3 + # This option is checked later by waflib + Options.options.python = 'python3' + conf.msg('Configuring Waf to use python3: ', Options.options.python, 'GREEN') + if Options.options.enable_gcov: env['GCOV_ENABLED'] = True env.append_value('CCFLAGS', '-fprofile-arcs') @@ -1128,7 +1137,7 @@ def shutdown(ctx): # Write the build status file. build_status_file = os.path.join(bld.out_dir, 'build-status.py') out = open(build_status_file, 'w') - out.write('#! /usr/bin/env python\n') + out.write('#! /usr/bin/env python3\n') out.write('\n') out.write('# Programs that are runnable.\n') out.write('ns3_runnable_programs = ' + str(env['NS3_RUNNABLE_PROGRAMS']) + '\n')