[Scons-users] Getting scons to work on windows

Evan Driscoll driscoll at cs.wisc.edu
Sun Sep 8 01:15:05 EDT 2013


On 9/7/2013 11:59 PM, Evan Driscoll wrote:

> Is there an scons.py file in c:\python27\scripts? If not, is there one

> anywhere else, like somewhere under arcgis10.1/?


By the way, my next question, if the answer to this is 'yes', is going
to be what happens if you run

c:\python27\python c:\python27\scripts\scons.py

(or with the scons.py path adjusted appropriately).

If that works, then you can probably just take the attached scons.bat
and stick it in your path somewhere. If scons.py is around but not in
that path, you'll have to adjust the 'scriptname=%~dp0Scripts\%~n0.py'
on line 22 as appropriate. (The %~dp0 is a variable expansion that will
expand to whatever directory the .bat file is in.)

If the answer is 'no', or scons.py is around but the above suggestion
doesn't work, then I am out of suggestions other than to try
uninstalling and install from source, and someone who's actually on the
project and not a user might have more ideas. :-)

Evan


-------------- next part --------------
@REM Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation
@REM src/script/scons.bat issue-2856:2676:d23b7a2f45e8 2012/08/05 15:38:28 garyo
@echo off
set SCONS_ERRORLEVEL=
if "%OS%" == "Windows_NT" goto WinNT

@REM for 9x/Me you better not have more than 9 args
python -c "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-2.2.0'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-2.2.0'), join(sys.prefix, 'scons')] + sys.path; import SCons.Script; SCons.Script.main()" %1 %2 %3 %4 %5 %6 %7 %8 %9
@REM no way to set exit status of this script for 9x/Me
goto endscons

@REM Credit where credit is due: we return the exit code despite our
@REM use of setlocal+endlocal using a technique from Bear's Journal:
@REM http://code-bear.com/bearlog/2007/06/01/getting-the-exit-code-from-a-batch-file-that-is-run-from-a-python-program/


:WinNT

setlocal
@REM ensure the script will be executed with the Python it was installed for
set path=%~dp0;%~dp0..;%path%
@REM try the script named as the .bat file in current dir, then in Scripts subdir
set scriptname=%~dp0%~n0.py
if not exist %scriptname% set scriptname=%~dp0Scripts\%~n0.py
python "%scriptname%" %*
endlocal & set SCONS_ERRORLEVEL=%ERRORLEVEL%

if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto returncode
if errorlevel 9009 echo you do not have python in your PATH
goto endscons


:returncode

exit /B %SCONS_ERRORLEVEL%


:endscons

call :returncode %SCONS_ERRORLEVEL%


More information about the Scons-users mailing list