Improve the scons.bat script. (Alex Jacques)
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 30 Apr 2002 02:48:52 +0000 (02:48 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Tue, 30 Apr 2002 02:48:52 +0000 (02:48 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@353 fdb21ef1-2011-0410-befe-b5e4ea1792b1

HOWTO/release.txt
etc/TestSCons.py
runtest.py
src/CHANGES.txt
src/script/scons.bat

index 7c37637eedf4ec7a124d09342d810bf8fb49c495..a24caa418cb27d35023a3434f24eb9a060aadd18 100644 (file)
@@ -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
 
index d90949ec25bef3e65d0a31dcaca6170cdd3dfe07..92001c3b59007bc360420a774b12a669bef4c845 100644 (file)
@@ -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'):
index b894a7fe9e7fd964f5ae11ed5dafd341fbe70049..b9e52ceee88db92bb713bcdf54ccd6852ed0de34 100644 (file)
 #                      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 = []
index 3cd3402ad6767672b5fb9f855fb1a3ed2e1df11e..28375d24b0c25f25b1db2a489e283564d54f04af 100644 (file)
@@ -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.
index e66b5d1c8560252f1482117cc8e39b6de37b8867..3955f281735b68c7cb3e0ff7b651845e3a41c3bb 100644 (file)
@@ -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