From b153a2046e646a25f9ab4beb67dd1c5a67c9ee80 Mon Sep 17 00:00:00 2001 From: "Francisco R. Del Roio" Date: Wed, 30 Aug 2017 00:29:16 -0300 Subject: [PATCH 1/3] Use Python launcher if present I was having some problems because I have two Python interpreters installed. So I changed the script to use the launcher. Cheers, --- scons.bat | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/scons.bat b/scons.bat index 399278c22b9..de2637468b8 100644 --- a/scons.bat +++ b/scons.bat @@ -1,5 +1,13 @@ @echo off rem We need this script because .py probably isn't in pathext. rem We can't just call python -c because it may not be in the path. -rem Python registers itself with the .py extension, so call scons.py. -"%~dp0\scons.py" %* +rem Instead, find the python launcher (installed by python 3) +where py >nul +if not ERRORLEVEL 0 ( + rem Python registers itself with the .py extension, so call scons.py. + "%~dp0\scons.py" %* +) else ( + rem Python launcher is present in the PATH + rem Call python 2.7 for 32 bits + py -2.7-32 "%~dp0\scons.py" %* +) From c54f0005a7a26794a1439bf7565891e72d2f0717 Mon Sep 17 00:00:00 2001 From: "Francisco R. Del Roio" Date: Tue, 3 Oct 2017 00:24:05 -0300 Subject: [PATCH 2/3] Fixed scons.bat to make use of `&&` and `||` operators instead of `if` --- scons.bat | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scons.bat b/scons.bat index de2637468b8..7b55f8833c0 100644 --- a/scons.bat +++ b/scons.bat @@ -2,12 +2,11 @@ rem We need this script because .py probably isn't in pathext. rem We can't just call python -c because it may not be in the path. rem Instead, find the python launcher (installed by python 3) -where py >nul -if not ERRORLEVEL 0 ( - rem Python registers itself with the .py extension, so call scons.py. - "%~dp0\scons.py" %* -) else ( +where py >nul&& ( rem Python launcher is present in the PATH rem Call python 2.7 for 32 bits py -2.7-32 "%~dp0\scons.py" %* +) || ( + rem Python registers itself with the .py extension, so call scons.py. + "%~dp0\scons.py" %* ) From 44046b625136d9774150b033a01778878b3bc1a8 Mon Sep 17 00:00:00 2001 From: "Francisco R. Del Roio" Date: Tue, 3 Oct 2017 07:46:00 -0300 Subject: [PATCH 3/3] Redirected stdout and stderr to nul and switched back to an if structure because of unexpected behavior when interrupting a command or when it exits with errors --- scons.bat | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scons.bat b/scons.bat index 7b55f8833c0..24dcec371c6 100644 --- a/scons.bat +++ b/scons.bat @@ -2,11 +2,12 @@ rem We need this script because .py probably isn't in pathext. rem We can't just call python -c because it may not be in the path. rem Instead, find the python launcher (installed by python 3) -where py >nul&& ( +where py 1>nul 2>&1 +if "%ERRORLEVEL%" == "0" ( rem Python launcher is present in the PATH rem Call python 2.7 for 32 bits py -2.7-32 "%~dp0\scons.py" %* -) || ( +) else ( rem Python registers itself with the .py extension, so call scons.py. "%~dp0\scons.py" %* )