From 35a9fe7b3a3575367b74fbaf84f5336ee4ca5573 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Tue, 30 Apr 2002 02:48:52 +0000 Subject: Improve the scons.bat script. (Alex Jacques) --- HOWTO/release.txt | 4 ++-- etc/TestSCons.py | 16 ++++++++++------ runtest.py | 21 ++++++++++++++++++--- src/CHANGES.txt | 9 +++++++++ src/script/scons.bat | 15 +++++++++++++-- 5 files changed, 52 insertions(+), 13 deletions(-) diff --git a/HOWTO/release.txt b/HOWTO/release.txt index 7c37637..a24caa4 100644 --- a/HOWTO/release.txt +++ b/HOWTO/release.txt @@ -14,11 +14,11 @@ Things to do to release a new version of SCons: cd scons-{version} python setup.py install cd scons-src-{version} - python runtest.py -a -x C:\Python15\scons.bat + python runtest.py -a -X -x C:\Python20\scons.bat 3) scons-{verson}.win32.exe cd scons-src-{version} - python runtest.py -a -x C:\Python15\scons.bat + python runtest.py -a -X -x C:\Python20\scons.bat Read through the README and src/README.txt files for any updates diff --git a/etc/TestSCons.py b/etc/TestSCons.py index d90949e..92001c3 100644 --- a/etc/TestSCons.py +++ b/etc/TestSCons.py @@ -18,6 +18,8 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" import os import os.path import string +import sys + import TestCmd class TestFailed(Exception): @@ -73,12 +75,14 @@ class TestSCons(TestCmd.TestCmd): is not necessary. """ if not kw.has_key('program'): - if os.path.exists('scons'): - kw['program'] = 'scons' - else: - kw['program'] = 'scons.py' - if not kw.has_key('interpreter'): - kw['interpreter'] = 'python' + kw['program'] = os.environ.get('SCONS') + if not kw['program']: + if os.path.exists('scons'): + kw['program'] = 'scons' + else: + kw['program'] = 'scons.py' + if not kw.has_key('interpreter') and not os.environ.get('SCONS_EXEC'): + kw['interpreter'] = sys.executable if not kw.has_key('match'): kw['match'] = TestCmd.match_exact if not kw.has_key('workdir'): diff --git a/runtest.py b/runtest.py index b894a7f..b9e52ce 100644 --- a/runtest.py +++ b/runtest.py @@ -23,11 +23,16 @@ # debugger (pdb.py) so you don't have to # muck with PYTHONPATH yourself. # +# -p package Test against the specified package. +# # -q Quiet. By default, runtest.py prints the # command line it will execute before # executing it. This suppresses that print. # -# -p package Test against the specified package. +# -X The scons "script" is an executable; don't +# feed it to Python. +# +# -x scons The scons script to use for tests. # # (Note: There used to be a -v option that specified the SCons # version to be tested, when we were installing in a version-specific @@ -48,20 +53,24 @@ debug = '' tests = [] printcmd = 1 package = None +scons = None +scons_exec = None if sys.platform == 'win32': lib_dir = os.path.join(sys.exec_prefix, "lib") else: lib_dir = os.path.join(sys.exec_prefix, "lib", "python" + sys.version[0:3]) -opts, tests = getopt.getopt(sys.argv[1:], "adqp:", - ['all', 'debug', 'quiet', 'package=']) +opts, tests = getopt.getopt(sys.argv[1:], "adqp:Xx:", + ['all', 'debug', 'exec=', 'quiet', 'package=']) for o, a in opts: if o == '-a' or o == '--all': all = 1 elif o == '-d' or o == '--debug': debug = os.path.join(lib_dir, "pdb.py") elif o == '-q' or o == '--quiet': printcmd = 0 elif o == '-p' or o == '--package': package = a + elif o == '-X': scons_exec = 1 + elif o == '-x' or o == '--exec': scons = a cwd = os.getcwd() @@ -123,6 +132,12 @@ os.environ['PYTHONPATH'] = lib_dir + \ os.pathsep + \ os.path.join(cwd, 'etc') +if scons: + os.environ['SCONS'] = scons + +if scons_exec: + os.environ['SCONS_EXEC'] = '1' + os.chdir(scons_dir) fail = [] diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 3cd3402..28375d2 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -78,6 +78,11 @@ RELEASE 0.07 - Thu, 25 Apr 2002 06:24:50 -0500 - Fix for relative CPPPATH directories in subsidiary SConscript files (broken in 0.06). + From Alex Jacques: + + - Create a better scons.bat file from a py2bat.py script on the Python + mailing list two years ago (modeled after pl2bat.pl). + From Steven Knight: - Fix so that -c -n does *not* remove the targets! @@ -96,6 +101,10 @@ RELEASE 0.07 - Thu, 25 Apr 2002 06:24:50 -0500 - Support building a PDF file directly from a TeX or LaTeX file using pdftex or pdflatex. + - Add a -x option to runtest.py to specify the script being tested. + A -X option indicates it's an executable, not a script to feed + to the Python interpreter. + From Steve Leblanc: - Add the SConscriptChdir() method. diff --git a/src/script/scons.bat b/src/script/scons.bat index e66b5d1..3955f28 100644 --- a/src/script/scons.bat +++ b/src/script/scons.bat @@ -1,2 +1,13 @@ -@rem __FILE__ __REVISION__ __DATE__ __DEVELOPER__ -@python -c "import SCons.Script; SCons.Script.main()" %1 %2 %3 %4 %5 %6 %7 %8 %9 +@echo off +if "%OS%" == "Windows_NT" goto WinNT +REM for 9x/Me you better not have more than 9 args +python -c "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 +:WinNT +python -c "import SCons.Script; SCons.Script.main()" %* +if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endscons +if errorlevel 9009 echo you do not have python in your PATH +REM color 00 causes this script to exit with non-zero exit status +if errorlevel 1 color 00 +:endscons -- cgit v0.12