Anonymous avatar Anonymous committed cd3a5ee

Merged revisions 2949-2953,2955-3056 via svnmerge from
http://scons.tigris.org/svn/scons/branches/core

................
r2955 | stevenknight | 2008-05-18 07:48:43 -0700 (Sun, 18 May 2008) | 2 lines

Update lines for next development cycle.
................
r2956 | GregNoel | 2008-05-19 14:24:39 -0700 (Mon, 19 May 2008) | 1 line

Fix typo in Mkdir() description
................
r2957 | cournape | 2008-05-19 22:37:17 -0700 (Mon, 19 May 2008) | 1 line

sunc++ tool: do not parse pkgchk output if no output available (Fix for #2060).
................
r2958 | cournape | 2008-05-19 23:34:01 -0700 (Mon, 19 May 2008) | 6 lines

Do not set cppcPath to CXX if CXX has no dirname. This caused weird behaviour,
because cppcPath and cxx were joined together, and scons used things like CC/CC
as CXX.
................
r2960 | cournape | 2008-05-20 22:23:12 -0700 (Tue, 20 May 2008) | 3 lines

Initialized merge tracking via "svnmerge" with revisions "1-2959" from
http://scons.tigris.org/svn/scons/branches/pyext
................
r2971 | stevenknight | 2008-05-22 16:01:11 -0700 (Thu, 22 May 2008) | 4 lines

Issue 2056: Fix scons.bat so that it returns the SCons exit status even
though we're using setlocal + endlocal to avoid polluting the calling
user's %PATH% variable.
................
r2972 | stevenknight | 2008-05-22 16:35:00 -0700 (Thu, 22 May 2008) | 2 lines

Move generic windows tests from the test/ subdirectory into test/Win32.
................
r2973 | stevenknight | 2008-05-22 18:58:35 -0700 (Thu, 22 May 2008) | 2 lines

Fix scoping under Python 1.5 / 2.0 / 2.1.
................
r2976 | cournape | 2008-05-23 04:10:37 -0700 (Fri, 23 May 2008) | 3 lines

Initialized merge tracking via "svnmerge" with revisions "1-2975" from
http://scons.tigris.org/svn/scons/branches/libwithcontext
................
r2978 | GregNoel | 2008-05-23 12:39:42 -0700 (Fri, 23 May 2008) | 1 line

script to convert XML issues into CSV spreadsheet
................
r2987 | GregNoel | 2008-05-25 10:57:14 -0700 (Sun, 25 May 2008) | 1 line

trivial typo
................
r2989 | pankrat | 2008-05-25 14:42:53 -0700 (Sun, 25 May 2008) | 3 lines

Initialized merge tracking via "svnmerge" with revisions "1-2988" from
http://scons.tigris.org/svn/scons/branches/heapmonitor
................
r2992 | belley | 2008-05-27 08:23:34 -0700 (Tue, 27 May 2008) | 41 lines

Fixed the detection of Intel C++ Compiler for EMT64

The table used to check the registry keys for installed versions of
the Intel C++ compiler for EMT64 seems erroneous. I have double check
using the Intel C++ compiler versions 9.1 and 10.0 on both Windows XP
32-bit and Windows Server2003 64-bits.

The registry keys have the form

HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\Compilers\C++\100.025\IA32
HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\Compilers\C++\100.025\IA64
HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\Compilers\C++\100.025\EMT64

Benoit

Index: src/engine/SCons/Tool/intelc.py
===================================================================
*** src/engine/SCons/Tool/intelc.py (revision 2991)
--- src/engine/SCons/Tool/intelc.py (working copy)
***************
*** 101,108 ****
valid_abis = {'ia32' : 'ia32',
'x86' : 'ia32',
'ia64' : 'ia64',
! 'em64t' : 'ia32e',
! 'amd64' : 'ia32e'}
if is_linux:
valid_abis = {'ia32' : 'ia32',
'x86' : 'ia32',
--- 101,108 ----
valid_abis = {'ia32' : 'ia32',
'x86' : 'ia32',
'ia64' : 'ia64',
! 'em64t' : 'em64t',
! 'amd64' : 'em64t'}
if is_linux:
valid_abis = {'ia32' : 'ia32',
'x86' : 'ia32',
................
r2993 | stevenknight | 2008-05-27 16:22:35 -0700 (Tue, 27 May 2008) | 3 lines

Issue 2062: Fix --interactive mode getting "stuck" reporting failures
for every build after the first one that fails.
................
r2997 | stevenknight | 2008-05-28 18:18:36 -0700 (Wed, 28 May 2008) | 4 lines

Fix the closing message on interrupt to report "building terminated
because of errors." Add a missing test.pass_test() call to the
end of test/KeyboardInterrupt.py.
................
r2998 | stevenknight | 2008-05-29 08:14:47 -0700 (Thu, 29 May 2008) | 2 lines

Issue 2075: Fix the ability to call the Node.FS.File.File() method.
................
r2999 | stevenknight | 2008-05-29 14:12:07 -0700 (Thu, 29 May 2008) | 2 lines

Issue 2063: On Mac OS X, install under /usr/local by default.
................
r3017 | stevenknight | 2008-05-30 08:05:26 -0700 (Fri, 30 May 2008) | 3 lines

Get the fix for File.File() right this time. Apply the same fix
to File.Dir() and File.Entry(), too.
................
r3022 | stevenknight | 2008-06-02 18:52:42 -0700 (Mon, 02 Jun 2008) | 3 lines

Fix "deprecated conversion from string constant to char *" warnings in
various C++ tests.
................
r3045 | garyo | 2008-06-05 06:05:37 -0700 (Thu, 05 Jun 2008) | 8 lines

This fix uses Python sequence comparison to compare the dotted version
numbers used in .NET version numbers rather than comparing each
element of the list individually. It's more robust and also more
correct. I also fixed a Python 1.5.2 compatibility issue (strings
didn't have the split method).

Original reporter confirms this fixes his issue.
................
r3046 | garyo | 2008-06-05 20:35:27 -0700 (Thu, 05 Jun 2008) | 1 line

Minor doc tweaks to Users Guide.
................
r3050 | stevenknight | 2008-06-06 11:38:38 -0700 (Fri, 06 Jun 2008) | 21 lines

Merged revisions 2877,2879-2978,2980-3019,3021-3048 via svnmerge from
http://scons.tigris.org/svn/scons/branches/fortran_refactor

........
r2980 | cournape | 2008-05-23 21:56:19 -0700 (Fri, 23 May 2008) | 1 line

Emit a warning and use as a linker when fortran and c++ codes are mixed.
........
r3000 | cournape | 2008-05-29 21:29:37 -0700 (Thu, 29 May 2008) | 1 line

Improve warning when mixing c++ and fortran.
........
r3048 | stevenknight | 2008-06-06 11:30:25 -0700 (Fri, 06 Jun 2008) | 6 lines

Issue 2047: update the warning text to make it less alarming.
Move the warning classes so they can be suppressed.
Add a test of the warning (and suppression) behavior
Only issue one warning per SCons invocation, not one per built executable.
Update CHANGES.txt and RELEASE.txt.
........
................
r3051 | stevenknight | 2008-06-07 08:11:46 -0700 (Sat, 07 Jun 2008) | 3 lines

Fix the Fortran/C++ link test for deprecation warnings
under earlier Python version.
................
r3052 | stevenknight | 2008-06-07 08:12:22 -0700 (Sat, 07 Jun 2008) | 2 lines

Add Benoit's EMT64 change that will be released in 0.98.5.
................
r3053 | stevenknight | 2008-06-07 08:21:50 -0700 (Sat, 07 Jun 2008) | 2 lines

Update lines for 0.98.5 release.
................
r3054 | stevenknight | 2008-06-07 08:26:04 -0700 (Sat, 07 Jun 2008) | 2 lines

Update 0.98.4 versions to 0.98.5.
................

Comments (0)

Files changed (34)

QMTest/TestSCons.py

 # here provides some independent verification that what we packaged
 # conforms to what we expect.
 
-default_version = '0.98.4'
+default_version = '0.98.5'
 
 copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008'
 
     --  (Optional.)  Install from a pre-packaged SCons package that
         does not require distutils:
 
-            Red Hat Linux       scons-0.98.4.noarch.rpm
+            Red Hat Linux       scons-0.98.5.noarch.rpm
 
             Debian GNU/Linux    use apt-get to get the official package
 
-            Windows             scons-0.98.4.win32.exe
+            Windows             scons-0.98.5.win32.exe
 
     --  (Recommended.)  Download the latest distutils package from the
         following URL:
 
 By default, the above commands will do the following:
 
-    --  Install the version-numbered "scons-0.98.4" and "sconsign-0.98.4"
+    --  Install the version-numbered "scons-0.98.5" and "sconsign-0.98.5"
         scripts in the default system script directory (/usr/bin or
         C:\Python*\Scripts, for example).  This can be disabled by
         specifying the "--no-version-script" option on the command
         making it the default on your system.
 
         On UNIX or Linux systems, you can have the "scons" and "sconsign"
-        scripts be hard links or symbolic links to the "scons-0.98.4" and
-        "sconsign-0.98.4" scripts by specifying the "--hardlink-scons" or
+        scripts be hard links or symbolic links to the "scons-0.98.5" and
+        "sconsign-0.98.5" scripts by specifying the "--hardlink-scons" or
         "--symlink-scons" options on the command line.
 
-    --  Install "scons-0.98.4.bat" and "scons.bat" wrapper scripts in the
+    --  Install "scons-0.98.5.bat" and "scons.bat" wrapper scripts in the
         Python prefix directory on Windows (C:\Python*, for example).
         This can be disabled by specifying the "--no-install-bat" option
         on the command line.
 
         On UNIX or Linux systems, the "--install-bat" option may be
-        specified to have "scons-0.98.4.bat" and "scons.bat" files installed
+        specified to have "scons-0.98.5.bat" and "scons.bat" files installed
         in the default system script directory, which is useful if you
         want to install SCons in a shared file system directory that can
         be used to execute SCons from both UNIX/Linux and Windows systems.
 
     --  Install the SCons build engine (a Python module) in an
         appropriate version-numbered SCons library directory
-        (/usr/lib/scons-0.98.4 or C:\Python*\scons-0.98.4, for example).
+        (/usr/lib/scons-0.98.5 or C:\Python*\scons-0.98.5, for example).
         See below for more options related to installing the build
         engine library.
 
 Depending on the utilities installed on your system, any or all of the
 following packages will be built:
 
-        build/dist/scons-0.98.4-1.noarch.rpm
-        build/dist/scons-0.98.4-1.src.rpm
-        build/dist/scons-0.98.4.linux-i686.tar.gz
-        build/dist/scons-0.98.4.tar.gz
-        build/dist/scons-0.98.4.win32.exe
-        build/dist/scons-0.98.4.zip
-        build/dist/scons-doc-0.98.4.tar.gz
-        build/dist/scons-local-0.98.4.tar.gz
-        build/dist/scons-local-0.98.4.zip
-        build/dist/scons-src-0.98.4.tar.gz
-        build/dist/scons-src-0.98.4.zip
-        build/dist/scons_0.98.4-1_all.deb
+        build/dist/scons-0.98.5-1.noarch.rpm
+        build/dist/scons-0.98.5-1.src.rpm
+        build/dist/scons-0.98.5.linux-i686.tar.gz
+        build/dist/scons-0.98.5.tar.gz
+        build/dist/scons-0.98.5.win32.exe
+        build/dist/scons-0.98.5.zip
+        build/dist/scons-doc-0.98.5.tar.gz
+        build/dist/scons-local-0.98.5.tar.gz
+        build/dist/scons-local-0.98.5.zip
+        build/dist/scons-src-0.98.5.tar.gz
+        build/dist/scons-src-0.98.5.zip
+        build/dist/scons_0.98.5-1_all.deb
 
 The SConstruct file is supposed to be smart enough to avoid trying to
 build packages for which you don't have the proper utilities installed.
 copyright_years = '2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008'
 
 # This gets inserted into the man pages to reflect the month of release.
-month_year = 'May 2008'
+month_year = 'June 2008'
 
 #
 # __COPYRIGHT__
 import tempfile
 
 project = 'scons'
-default_version = '0.98.4'
+default_version = '0.98.5'
 copyright = "Copyright (c) %s The SCons Foundation" % copyright_years
 
 SConsignFile()
+#!/usr/bin/env python
+
+# Download the issues from Issuzilla as XML; this creates a file named
+# 'issues.xml'.  Run this script to translate 'issues.xml' into a CSV
+# file named 'editlist.csv'.  Upload the CSV into a Google spreadsheet.
+
+# In the spreadsheet, select the last column and delete it (added by the
+# upload to allow for expansion; we don't need it).
+# Select all the columns and pick "align-->top"
+# Select the ID and votes columns and pick "align-->right"
+# Select the priority column and pick "align-->center"
+# Select the first row and click on the "bold" button
+# Grab the lines between the column headers to adjust the column widths
+# Grab the sort bar on the far left (just above the "1" for row one)
+# and move it down one row.  (Row one becomes a floating header)
+# Voila!
+
+# The team members
+# FIXME: These names really should be external to this script
+team = 'Bill Greg Steven Gary Ken Brandon Sohail Jim'.split()
+team.sort()
+
+# The elements to be picked out of the issue
+PickList = [
+	# sort key -- these are used to sort the entry
+	'target_milestone', 'priority', 'votes_desc', 'creation_ts',
+	# payload -- these are displayed
+	'issue_id', 'votes', 'issue_type', 'target_milestone',
+	'priority', 'assigned_to', 'short_desc',
+	]
+
+# Conbert a leaf element into its value as a text string
+# We assume it's "short enough" that there's only one substring
+def Value(element):
+	v = element.firstChild
+	if v is None: return ''
+	return v.nodeValue
+
+# Parse the XML issues file and produce a DOM for it
+# FIXME: parameterize the input file name
+from xml.dom.minidom import parse
+xml = parse('issues.xml')
+
+# Go through the issues in the DOM, pick out the elements we want,
+# and put them in our list of issues.
+issues = []
+for issuezilla in xml.childNodes:
+	# The Issuezilla element contains the issues
+	if issuezilla.nodeType != issuezilla.ELEMENT_NODE: continue
+	for issue in issuezilla.childNodes:
+		# The issue elements contain the info for an issue
+		if issue.nodeType != issue.ELEMENT_NODE: continue
+		# Accumulate the pieces we want to include
+		d = {}
+		for element in issue.childNodes:
+			if element.nodeName in PickList:
+				d[element.nodeName] = Value(element)
+		# convert 'votes' to numeric, ascending and descending
+		try:
+			v = int('0' + d['votes'])
+		except KeyError:
+			pass
+		else:
+			d['votes_desc'] = -v
+			d['votes'] = v
+		# Marshal the elements and add them to the list
+		issues.append([ d[ix] for ix in PickList ])
+issues.sort()
+
+# Transcribe the issues into comma-separated values.
+# FIXME: parameterize the output file name
+import csv
+writer = csv.writer(open('editlist.csv', 'w'))
+# header
+writer.writerow(['ID', 'Votes', 'Type/Member', 'Milestone',
+		'Pri', 'Owner', 'Summary/Comments'])
+for issue in issues:
+	row = issue[4:]		# strip off sort key
+	#row[0] = """=hyperlink("http://scons.tigris.org/issues/show_bug.cgi?id=%s","%s")""" % (row[0],row[0])
+	if row[3] == '-unspecified-': row[3] = 'triage'
+	writer.writerow(['','','','','','',''])
+	writer.writerow(row)
+	writer.writerow(['','','consensus','','','',''])
+	writer.writerow(['','','','','','',''])
+	for member in team: writer.writerow(['','',member,'','','',''])
 Enables or disables warnings about missing SConscript files.
 
 .TP
+--warn=fortran-cxx-mix, --warn=no-fortran-cxx-mix
+Enables or disables the specific warning about linking
+Fortran and C++ object files in a single executable,
+which can yield unpredictable behavior with some compilers.
+
+.TP
+--warn=link, --warn=no-link
+Enables or disables warnings about link steps.
+
+.TP
 --warn=misleading-keywords, --warn=no-misleading-keywords
 Enables or disables warnings about use of the misspelled keywords
 .B targets
 and the construction variables they affect
 are as specified for the
 .BR env.ParseFlags ()
-method (which thie method calls).
+method (which this method calls).
 See that method's description, below,
 for a table of options and construction variables.
 
 
 env.Command('foo.out', 'foo.in',
             [Mkdir('/tmp/builddir',
-             Copy('$SOURCE', '/tmp/builddir')
-             "cd /tmp/builddir && ])
-
+             Copy('$SOURCE', '/tmp/builddir/foo.in')
+             "cd /tmp/builddir && make",
+             Copy('/tmp/builddir/foo.out', '$TARGET')])
 .EE
 
 .TP

doc/user/add-method.in

   </para>
 
   <scons_output example="ex1">
-    <scons_output_command>scons -Q</scons_output_command>
+    <scons_output_command>scons -Q /</scons_output_command>
   </scons_output>
 
   <para>

doc/user/add-method.xml

   </para>
 
   <screen>
-    % <userinput>scons -Q</userinput>
+    % <userinput>scons -Q /</userinput>
     cc -o hello.o -c hello.c
     cc -o hello hello.o
     Install file: "hello" as "install/bin/hello"
+    Install file: "hello" as "/usr/bin/hello"
   </screen>
 
   <para>

doc/user/builders-writing.in

     <file name="site_scons/my_utils.py" printme=1>
       def build_id():
          """Return a build ID (stub version)"""
-	 return "100"
+         return "100"
     </file>
     <file name="SConscript">
       import my_utils

doc/user/builders-writing.xml

   <programlisting>
       def build_id():
          """Return a build ID (stub version)"""
-	 return "100"
+         return "100"
   </programlisting>
 
   <para>
 
 
 
+RELEASE 0.98.5 - Sat, 07 Jun 2008 08:20:35 -0700
+
+  From Benoit Belley:
+
+  - Fix the Intel C++ compiler ABI specification for EMT64 processors.
+
+  From David Cournapeau:
+
+  - Issue a (suppressable) warning, not an error, when trying to link
+    C++ and Fortran object files into the same executable.
+
+  From Steven Knight:
+
+  - Update the scons.bat file so that it returns the real exit status
+    from SCons, even though it uses setlocal + endlocal.
+
+  - Fix the --interactive post-build messages so it doesn't get stuck
+    mistakenly reporting failures after any individual build fails.
+
+  - Fix calling File() as a File object method in some circumstances.
+
+  - Fix setup.py installation on Mac OS X so SCons gets installed
+    under /usr/lcoal by default, not in the Mac OS X Python framework.
+
+
+
 RELEASE 0.98.4 - Sat, 17 May 2008 22:14:46 -0700
 
   From Benoit Belley:
 
 
 
-RELEASE 0.98.4 - Sat, 17 May 2008 22:14:46 -0700
+RELEASE 0.98.5 - Sat, 07 Jun 2008 08:20:35 -0700
 
   This is a release candidate for SCons 1.0.  Please consult the
   CHANGES.txt file for a list of specific changes since last release.
 
+  Please note the following important changes since release 0.98.4:
+
+    --  scons.bat NOW RETURNS THE REAL SCONS EXIT STATUS
+
+        The scons.bat script shipped with SCons used to exit with
+        a status of 1 when it detected any failed (non-zero) exit
+        status from the underlying Python execution of SCons itself.
+        The scons.bat script now exits with the actual status
+        returned by SCons.
+
+    --  SCONS NOW WARNS WHEN TRYING TO LINK C++ AND FORTRAN OBJECT FILES
+
+        Some C++ toolchains do not understand Fortran runtimes and create
+        unpredictable executables when linking C++ and Fortran object
+        files together.  SCons now issues a warning if you try to link
+        C++ and Fortran object files into the same executable:
+
+            scons: warning: Using $CXX to link Fortran and C++ code together.
+                    This may generate a buggy executable if the '/usr/bin/gcc'
+                    compiler does not know how to deal with Fortran runtimes.
+
+        The warning may be suppressed with either the --warning=no-link
+        or --warning=no-fortran-cxx-mix command line options, or by
+        adding either of the following lines to a SConscript file:
+
+            SetOption('warn', 'no-link')
+            SetOption('warn', 'no-fortran-cxx-mix')
+
   Please note the following important changes since release 0.98:
 
     --  SCONS NO LONGER SETS THE GNU TOOLCHAIN -fPIC FLAG IN $SHCXXFLAGS

src/engine/SCons/Node/FS.py

     def Entry(self, name):
         """Create an entry node named 'name' relative to
         the SConscript directory of this file."""
-        return self.cwd.Entry(name)
+        cwd = self.cwd or self.fs._cwd
+        return cwd.Entry(name)
 
     def Dir(self, name, create=True):
         """Create a directory node named 'name' relative to
         the SConscript directory of this file."""
-        return self.cwd.Dir(name, create)
+        cwd = self.cwd or self.fs._cwd
+        return cwd.Dir(name, create)
 
     def Dirs(self, pathlist):
         """Create a list of directories relative to the SConscript
     def File(self, name):
         """Create a file node named 'name' relative to
         the SConscript directory of this file."""
-        return self.cwd.File(name)
+        cwd = self.cwd or self.fs._cwd
+        return cwd.File(name)
 
     #def generate_build_dict(self):
     #    """Return an appropriate dictionary of values for building

src/engine/SCons/Script/Main.py

     def do_failed(self, status=2):
         _BuildFailures.append(self.exception[1])
         global exit_status
+        global this_build_status
         if self.options.ignore_errors:
             SCons.Taskmaster.Task.executed(self)
         elif self.options.keep_going:
             SCons.Taskmaster.Task.fail_continue(self)
             exit_status = status
+            this_build_status = status
         else:
             SCons.Taskmaster.Task.fail_stop(self)
             exit_status = status
+            this_build_status = status
             
     def executed(self):
         t = self.targets[0]
         if self.targets[0].get_state() != SCons.Node.up_to_date or \
            (self.top and not self.targets[0].exists()):
             global exit_status
+            global this_build_status
             exit_status = 1
+            this_build_status = 1
             self.tm.stop()
 
     def executed(self):
 print_time = 0
 sconscript_time = 0
 cumulative_command_time = 0
-exit_status = 0 # exit status, assume success by default
+exit_status = 0 # final exit status, assume success by default
+this_build_status = 0 # "exit status" of an individual build
 num_jobs = None
 delayed_warnings = []
 
 
 def _main(parser):
     global exit_status
+    global this_build_status
 
     options = parser.values
 
     default_warnings = [ SCons.Warnings.CorruptSConsignWarning,
                          SCons.Warnings.DeprecatedWarning,
                          SCons.Warnings.DuplicateEnvironmentWarning,
+                         SCons.Warnings.LinkWarning,
                          SCons.Warnings.MissingSConscriptWarning,
                          SCons.Warnings.NoMD5ModuleWarning,
                          SCons.Warnings.NoMetaclassSupportWarning,
                          SCons.Warnings.NoParallelSupportWarning,
                          SCons.Warnings.MisleadingKeywordsWarning,
                          SCons.Warnings.StackSizeWarning, ]
+
     for warning in default_warnings:
         SCons.Warnings.enableWarningClass(warning)
     SCons.Warnings._warningOut = _scons_internal_warning
 
 def _build_targets(fs, options, targets, target_top):
 
+    global this_build_status
+    this_build_status = 0
+
     progress_display.set_mode(not (options.no_progress or options.silent))
     display.set_mode(not options.silent)
     SCons.Action.print_actions          = not options.silent
         if jobs.were_interrupted():
             progress_display("scons: Build interrupted.")
             global exit_status
+            global this_build_status
             exit_status = 2
+            this_build_status = 2
 
-        if exit_status:
+        if this_build_status:
             progress_display("scons: " + failure_message)
         else:
             progress_display("scons: " + closing_message)

src/engine/SCons/Tool/intelc.py

         valid_abis = {'ia32'  : 'ia32',
                       'x86'   : 'ia32',
                       'ia64'  : 'ia64',
-                      'em64t' : 'ia32e',
-                      'amd64' : 'ia32e'}
+                      'em64t' : 'em64t',
+                      'amd64' : 'em64t'}
     if is_linux:
         valid_abis = {'ia32'   : 'ia32',
                       'x86'    : 'ia32',

src/engine/SCons/Tool/link.py

 import SCons.Defaults
 import SCons.Tool
 import SCons.Util
-import SCons.Errors
+import SCons.Warnings
 
 from SCons.Tool.FortranCommon import isfortran
 
 cplusplus = __import__('c++', globals(), locals(), [])
 
+issued_mixed_link_warning = False
+
 def smart_link(source, target, env, for_signature):
     has_cplusplus = cplusplus.iscplusplus(source)
     has_fortran = isfortran(env, source)
     if has_cplusplus and has_fortran:
-        raise SCons.Errors.InternalError(
-                "Sorry, scons cannot yet link c++ and fortran code together.")
+        global issued_mixed_link_warning
+        if not issued_mixed_link_warning:
+            msg = "Using $CXX to link Fortran and C++ code together.\n\t" + \
+              "This may generate a buggy executable if the %s\n\t" + \
+              "compiler does not know how to deal with Fortran runtimes."
+            SCons.Warnings.warn(SCons.Warnings.FortranCxxMixWarning,
+                                msg % repr(env.subst('$CXX')))
+            issued_mixed_link_warning = True
+        return '$CXX'
     elif has_fortran:
         return '$FORTRAN'
     elif has_cplusplus:

src/engine/SCons/Tool/msvs.py

             # since version numbers aren't really floats...
             aa = a[1:]
             bb = b[1:]
-            aal = aa.split('.')
-            bbl = bb.split('.')
-            c = int(bbl[0]) - int(aal[0])
-            if c == 0:
-                c = int(bbl[1]) - int(aal[1])
-                if c == 0:
-                    c = int(bbl[2]) - int(aal[2])
-            return c
+            aal = string.split(aa, '.')
+            bbl = string.split(bb, '.')
+            # sequence comparison in python is lexicographical
+            # which is exactly what we want.
+            # Note we sort backwards so the highest version is first.
+            return cmp(bbl,aal)
 
         installed_framework_versions.sort(versrt)
 

src/engine/SCons/Tool/sunc++.py

 # use the package installer tool lslpp to figure out where cppc and what
 # version of it is installed
 def get_cppc(env):
-    cppcPath = env.get('CXX', None)
+    cxx = env.get('CXX', None)
+    if cxx:
+        cppcPath = os.path.dirname(cxx)
+    else:
+        cppcPath = None
+
     cppcVersion = None
 
     pkginfo = env.subst('$PKGINFO')
     pkgchk = env.subst('$PKGCHK')
 
-    for package in ['SPROcpl']:
-        cmd = "%s -l %s 2>/dev/null | grep '^ *VERSION:'" % (pkginfo, package)
-        line = os.popen(cmd).readline()
-        if line:
-            cppcVersion = line.split()[-1]
-            cmd = "%s -l %s 2>/dev/null | grep '^Pathname:.*/bin/CC$' | grep -v '/SC[0-9]*\.[0-9]*/'" % (pkgchk, package)
+    def look_pkg_db(pkginfo=pkginfo, pkgchk=pkgchk):
+        version = None
+        path = None
+        for package in ['SPROcpl']:
+            cmd = "%s -l %s 2>/dev/null | grep '^ *VERSION:'" % (pkginfo, package)
             line = os.popen(cmd).readline()
-            cppcPath = os.path.dirname(line.split()[-1])
-            break
+            if line:
+                version = line.split()[-1]
+                cmd = "%s -l %s 2>/dev/null | grep '^Pathname:.*/bin/CC$' | grep -v '/SC[0-9]*\.[0-9]*/'" % (pkgchk, package)
+                line = os.popen(cmd).readline()
+                if line:
+                    path = os.path.dirname(line.split()[-1])
+                    break
+
+        return path, version
+
+    path, version = look_pkg_db()
+    if path and version:
+        cppcPath, cppcVersion = path, version
+
     return (cppcPath, 'CC', 'CC', cppcVersion)
 
 def generate(env):

src/engine/SCons/Warnings.py

 class DuplicateEnvironmentWarning(Warning):
     pass
 
+class LinkWarning(Warning):
+    pass
+
 class MisleadingKeywordsWarning(Warning):
     pass
 
 class StackSizeWarning(Warning):
     pass
 
+class FortranCxxMixWarning(LinkWarning):
+    pass
+
 _warningAsException = 0
 
 # The below is a list of 2-tuples.  The first element is a class object.

src/script/scons.bat

 @REM __COPYRIGHT__
 @REM __FILE__ __REVISION__ __DATE__ __DEVELOPER__
 @echo off
+set SCONS_ERRORLEVEL=
 if "%OS%" == "Windows_NT" goto WinNT
-REM for 9x/Me you better not have more than 9 args
+
+@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-__VERSION__'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-__VERSION__'), 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%
 python -c "from os.path import join; import sys; sys.path = [ join(sys.prefix, 'Lib', 'site-packages', 'scons-__VERSION__'), join(sys.prefix, 'Lib', 'site-packages', 'scons'), join(sys.prefix, 'scons-__VERSION__'), join(sys.prefix, 'scons')] + sys.path; import SCons.Script; SCons.Script.main()" %*
-if NOT "%COMSPEC%" == "%SystemRoot%\system32\cmd.exe" goto endsconsnt
+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
-@REM color 00 causes this script to exit with non-zero exit status
-if errorlevel 1 color 00
-:endsconsnt
-endlocal
+goto endscons
+
+:returncode
+exit /B %SCONS_ERRORLEVEL%
+
 :endscons
+call :returncode %SCONS_ERRORLEVEL%
                 return os.path.join(drive + head)
     return libdir
 
+def force_to_usr_local(self):
+    """
+    A hack to decide if we need to "force" the installation directories
+    to be under /usr/local.  This is because Mac Os X Tiger and
+    Leopard, by default, put the libraries and scripts in their own
+    directories under /Library or /System/Library.
+    """
+    return (sys.platform[:6] == 'darwin' and
+            (self.install_dir[:9] == '/Library/' or
+             self.install_dir[:16] == '/System/Library/'))
+
 class install_lib(_install_lib):
     def finalize_options(self):
         _install_lib.finalize_options(self)
+        if force_to_usr_local(self):
+            self.install_dir = '/usr/local/lib'
         args = self.distribution.script_args
         if not set_explicitly("lib", args):
             # They didn't explicitly specify the installation
 class install_scripts(_install_scripts):
     def finalize_options(self):
         _install_scripts.finalize_options(self)
+        if force_to_usr_local(self):
+            self.install_dir = '/usr/local/bin'
         self.build_dir = os.path.join('build', 'scripts')
         msg = "Installed SCons scripts into %s" % self.install_dir
         Installed.append(msg)
         _install_data.initialize_options(self)
     def finalize_options(self):
         _install_data.finalize_options(self)
+        if force_to_usr_local(self):
+            self.install_dir = '/usr/local'
         if Options.install_man:
             if is_win32:
                 dir = 'Doc'

test/CXX/CCFLAGS.py

 int
 main(int argc, char *argv[])
 {
-        argv[argc++] = "--";
+        argv[argc++] = (char *)"--";
 #ifdef FOO
         printf("prog.c:  FOO\n");
 #endif

test/CXX/CXXFILESUFFIX.py

 int
 main(int argc, char *argv[])
 {
-        argv[argc++] = "--";
+        argv[argc++] = (char *)"--";
         printf("LEX\n");
         printf("%s\n");
         exit (0);

test/CXX/CXXFLAGS.py

 int
 main(int argc, char *argv[])
 {
-        argv[argc++] = "--";
+        argv[argc++] = (char *)"--";
 #ifdef FOO
         printf("prog.c:  FOO\n");
 #endif
 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
 
 """
-Verify that the File() global function and environment method work
-correctly, and that the former does not try to expand construction
-variables.
+Verify that:
+
+    --  the File() global function and environment method work correctly;
+    --  the former does not try to expand construction variables;
+    --  calling File() as a method of a File() object works correctly.
 """
 
 import TestSCons
 print env.File('eee')
 print env.File('$FOO')
 print env.File('${BAR}_$BAR')
+f1 = env.File('f1')
+print f1
+f2 = f1.File('f2')
+print f2
 """)
 
-test.run(stdout = test.wrap_stdout(read_str = """\
+expect = test.wrap_stdout(read_str = """\
 ddd
 $FOO
 ${BAR}_$BAR
 eee
 fff
 bbb_bbb
+f1
+f2
 """, build_str = """\
 scons: `.' is up to date.
-"""))
+""")
+
+test.run(stdout = expect)
 
 test.pass_test()

test/Interactive/failure.py

+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+"""
+Verify that when a build fails, later builds correctly report
+that their builds succeeded, and that we don't get "stuck" on
+reporting the earlier build failure.
+"""
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', """\
+def fail(target, source, env):
+    return 1
+Command('f1.out', 'f1.in', Action(fail))
+Command('f2.out', 'f2.in', Copy('$TARGET', '$SOURCE'))
+Command('1', [], Touch('$TARGET'))
+Command('2', [], Touch('$TARGET'))
+Command('3', [], Touch('$TARGET'))
+Command('4', [], Touch('$TARGET'))
+""")
+
+test.write('f1.in', "f1.in 1\n")
+test.write('f2.in', "f2.in 1\n")
+
+
+
+scons = test.start(arguments = '--interactive')
+
+scons.send("build f1.out\n")
+
+scons.send("build 1\n")
+
+test.wait_for(test.workpath('1'))
+
+test.must_not_exist(test.workpath('f1.out'))
+
+
+
+scons.send("build f2.out\n")
+
+scons.send("build 2\n")
+
+test.wait_for(test.workpath('2'))
+
+test.must_match(test.workpath('f2.out'), "f2.in 1\n")
+
+
+
+scons.send("build f1.out\n")
+
+scons.send("build 3\n")
+
+test.wait_for(test.workpath('3'))
+
+test.must_not_exist(test.workpath('f1.out'))
+
+
+
+test.write('f2.in', "f2.in 2\n")
+
+scons.send("build f2.out\n")
+
+scons.send("build 4\n")
+
+test.wait_for(test.workpath('4'))
+
+test.must_match(test.workpath('f2.out'), "f2.in 2\n")
+
+
+
+expect_stdout = """\
+scons: Reading SConscript files ...
+scons: done reading SConscript files.
+scons>>> scons: Building targets ...
+fail(["f1.out"], ["f1.in"])
+scons: building terminated because of errors.
+scons: Clearing cached node information ...
+scons: done clearing node information.
+scons>>> scons: Building targets ...
+Touch("1")
+scons: done building targets.
+scons: Clearing cached node information ...
+scons: done clearing node information.
+scons>>> scons: Building targets ...
+Copy("f2.out", "f2.in")
+scons: done building targets.
+scons: Clearing cached node information ...
+scons: done clearing node information.
+scons>>> scons: Building targets ...
+Touch("2")
+scons: done building targets.
+scons: Clearing cached node information ...
+scons: done clearing node information.
+scons>>> scons: Building targets ...
+fail(["f1.out"], ["f1.in"])
+scons: building terminated because of errors.
+scons: Clearing cached node information ...
+scons: done clearing node information.
+scons>>> scons: Building targets ...
+Touch("3")
+scons: done building targets.
+scons: Clearing cached node information ...
+scons: done clearing node information.
+scons>>> scons: Building targets ...
+Copy("f2.out", "f2.in")
+scons: done building targets.
+scons: Clearing cached node information ...
+scons: done clearing node information.
+scons>>> scons: Building targets ...
+Touch("4")
+scons: done building targets.
+scons: Clearing cached node information ...
+scons: done clearing node information.
+scons>>> 
+"""
+
+expect_stderr = """\
+scons: *** [f1.out] Error 1
+scons: *** [f1.out] Error 1
+"""
+
+test.finish(scons, stdout = expect_stdout, stderr = expect_stderr)
+
+
+
+test.pass_test()

test/KeyboardInterrupt.py

     runtest('-j16 --random')
     runtest('-j32 --random')
     runtest('-j64 --random')
+
+test.pass_test()

test/Win32/default-drive.py

+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+"""
+This test verifies (on Windows systems) that specifying an
+absolute path name without a drive letter uses the SConstruct
+file's drive as the default.
+"""
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os
+import os.path
+import string
+import sys
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+if sys.platform != 'win32':
+    msg = "Skipping drive-letter test on non-Windows platform '%s'\n" % sys.platform
+    test.skip_test(msg)
+
+test.subdir('src')
+
+test.write(['src', 'SConstruct'], """
+def cat(env, source, target):
+    target = str(target[0])
+    source = map(str, source)
+    f = open(target, "wb")
+    for src in source:
+        f.write(open(src, "rb").read())
+    f.close()
+
+env = Environment(BUILDERS={'Build':Builder(action=cat)})
+env.Build('../build/file.out', 'file.in')
+""")
+
+test.write(['src', 'file.in'], "src/file.in\n")
+
+build_file_out = test.workpath('build', 'file.out')
+
+print os.path.splitdrive(build_file_out)[1]
+test.run(chdir = 'src',
+         arguments = os.path.splitdrive(build_file_out)[1])
+
+test.must_match(['build', 'file.out'], "src/file.in\n")
+
+test.pass_test()

test/Win32/mingw.py

+"""
+This tests the MinGW C/C++ compiler support.
+"""
+
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+import sys
+import os.path
+import os
+import TestCmd
+import time
+import string
+
+test = TestSCons.TestSCons(match = TestCmd.match_re_dotall)
+
+# MinGW is Windows only:
+if sys.platform != 'win32':
+    msg = "Skipping mingw test on non-Windows platform '%s'\n" % sys.platform
+    test.skip_test(msg)
+
+# This test requires MinGW to be installed:
+test.write('SConstruct',"""
+from SCons.Tool.mingw import exists
+import sys
+env = Environment()
+if exists(env):
+    print 'mingw exists'
+sys.exit(0)
+""")
+
+test.run()
+if string.find(test.stdout(), 'mingw exists') == -1:
+    test.skip_test("No MinGW on this system, skipping test.\n")
+
+test.subdir('header')
+
+# Do the actual testing:
+test.write('SConstruct',"""
+env=Environment(tools=['mingw'])
+assert env['CC'] == 'gcc'
+env.StaticLibrary('static', 'static.cpp')
+env.SharedLibrary('shared', 'shared.cpp')
+env.SharedLibrary('cshared', ['cshared.c', 'cshared.def'])
+env.Program('test', ['test.cpp', env.RES('resource.rc', CPPPATH=['header'])], LIBS=['static', 'shared', 'cshared'], LIBPATH=['.'])
+""")
+
+test.write('test.cpp', '''
+#include <stdio.h>
+#include <windows.h>
+#include "resource.h"
+
+void shared_func(void);
+void static_func(void);
+extern "C" void cshared_func(void);
+
+int main(void) 
+{ 
+    printf("%s\\n", "test.cpp");
+    shared_func();
+    static_func();
+    cshared_func();
+
+    char test[1024];
+    LoadString(GetModuleHandle(NULL), IDS_TEST, test, sizeof(test));
+    printf("%d %s\\n", IDS_TEST, test);
+
+    return 0;
+}
+''')
+
+test.write('resource.rc', '''
+#include "resource.h"
+#include <resource2.h>
+
+STRINGTABLE DISCARDABLE 
+BEGIN
+    IDS_TEST RESOURCE_RC
+END
+''')
+
+test.write('resource.h', '''
+#define IDS_TEST 2001
+''')
+
+test.write('static.cpp', '''
+#include <stdio.h>
+
+void static_func(void)
+{
+    printf("%s\\n", "static.cpp");
+}
+''')
+
+test.write('shared.cpp', '''
+#include <stdio.h>
+
+void shared_func(void)
+{
+    printf("%s\\n", "shared.cpp");
+}
+''')
+
+test.write('cshared.c', '''
+#include <stdio.h>
+
+void cshared_func(void)
+{
+    printf("%s\\n", "cshared.c");
+}
+''')
+
+test.write('cshared.def', '''
+EXPORTS
+cshared_func
+''')
+
+
+
+test.write('header/resource2.h', '''
+#define RESOURCE_RC "resource.rc"
+''')
+
+# the mingw linker likes to print "Creating library file: libfoo.a" to stderr, but
+# we'd like for this test to pass once this bug is fixed, so match anything at all
+# that comes out of stderr:
+test.run(arguments='test.exe', stderr='.*')
+# ensure the source def for cshared.def got used, and there wasn't a target def for chshared.dll:
+test.fail_test(string.find(test.stdout(), 'cshared.def') == -1)
+test.fail_test(string.find(test.stdout(), '-Wl,--output-def,cshared.def') != -1)
+# ensure the target def got generated for the shared.dll:
+test.fail_test(not os.path.exists(test.workpath('shared.def')))
+test.run(program=test.workpath('test.exe'), stdout='test.cpp\nshared.cpp\nstatic.cpp\ncshared.c\n2001 resource.rc\n')
+
+# ensure that modifying the header causes the resource to be rebuilt:
+test.write('resource.h', '''
+#define IDS_TEST 2002
+''')
+test.run(arguments='test.exe', stderr='.*')
+test.run(program=test.workpath('test.exe'), stdout='test.cpp\nshared.cpp\nstatic.cpp\ncshared.c\n2002 resource.rc\n')
+
+# Test with specifying the default tool to make sure msvc setting doen't ruin it
+# for mingw:
+test.write('SConstruct',"""
+env=Environment(tools=['default', 'mingw'])
+assert env['CC'] == 'gcc'
+env.SharedLibrary('shared', 'shared.cpp')
+env.Program('test', 'test.cpp', LIBS=['static', 'shared', 'cshared'], LIBPATH=['.'])
+""")
+
+test.write('test.cpp', '''
+#include <stdio.h>
+
+void shared_func(void);
+
+int main(void) 
+{ 
+    printf("%s\\n", "test.cpp2");
+    shared_func();
+    return 0;
+}
+''')
+
+test.write('shared.cpp', '''
+#include <stdio.h>
+
+void shared_func(void)
+{
+    printf("%s\\n", "shared.cpp2");
+}
+''')
+
+# the mingw linker likes to print "Creating library file: libfoo.a" to stderr, but
+# we'd like for this test to pass once this bug is fixed, so match anything at all
+# that comes out of stderr:
+test.run(arguments='test.exe', stderr='.*')
+test.run(program=test.workpath('test.exe'), stdout='test.cpp2\nshared.cpp2\n')
+
+test.pass_test()

test/Win32/scons-bat-error.py

+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+"""
+Verify that the scons.bat file returns error codes as we expect.
+"""
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os
+import sys
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+if sys.platform != 'win32':
+    msg = "Skipping scons.bat test on non-Windows platform '%s'\n" % sys.platform
+    test.skip_test(msg)
+
+python = test.where_is('python')
+
+if not python:
+    msg = "Skipping scons.bat test; python is not on %PATH%.\n"
+    test.skip_test(msg)
+
+scons_bat = os.path.splitext(test.program)[0] + '.bat'
+
+if not os.path.exists(scons_bat):
+    msg = "Skipping scons.bat test; %s does not exist.\n" % scons_bat
+    test.skip_test(msg)
+
+test.write('scons.bat', test.read(scons_bat))
+
+# The scons.bat file tries to import SCons.Script from its sys.prefix
+# directories first (i.e., site-packages) which means this test might
+# end up using an installed SCons in preference to something local.
+# If so, create a SConstruct file that will exit with our expected
+# error status.  If there is *not* an installed SCons, we still want
+# this test to work, so we make a "SCons" package in the local
+# directory with a Script.py module that contains a main() function
+# that just exits with the expected status.
+
+test.subdir('SCons')
+
+test.write(['SCons', '__init__.py'], "")
+
+test.write(['SCons', 'Script.py'], """\
+import sys
+def main():
+    sys.exit(7)
+""")
+
+test.write('SConstruct', """\
+import sys
+sys.exit(7)
+""")
+
+test.run(program = 'scons.bat', status = 7)
+
+
+
+test.pass_test()

test/Win32/win32pathmadness.py

+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# Permission is hereby granted, free of charge, to any person obtaining
+# a copy of this software and associated documentation files (the
+# "Software"), to deal in the Software without restriction, including
+# without limitation the rights to use, copy, modify, merge, publish,
+# distribute, sublicense, and/or sell copies of the Software, and to
+# permit persons to whom the Software is furnished to do so, subject to
+# the following conditions:
+#
+# The above copyright notice and this permission notice shall be included
+# in all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+
+"""
+This test verifies that the build command signatures do not depend on
+the case of the drive letter on Windows. This is important because Windows is 
+inconsistent about which case is used for the drive letter.
+"""
+
+__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import TestSCons
+import sys
+import TestCmd
+import string
+import os.path
+
+test = TestSCons.TestSCons(match=TestCmd.match_re)
+
+if sys.platform != 'win32':
+    msg = "Skipping Windows path tests on non-Windows platform '%s'\n" % sys.platform
+    test.skip_test(msg)
+
+test.subdir('src', 'build', 'include', 'src2')
+
+test.write('src/SConstruct', """
+env=Environment(LIBS=['../build/foo'], CPPPATH=['../include'], CCCOM='$CC $CCFLAGS $CPPFLAGS $_CPPINCFLAGS /c ${SOURCES.abspath} /Fo$TARGET')
+foo=env.Object('../build/foo', 'foo.c')
+Default(env.Library('../build/foo', foo))
+Default(env.SharedLibrary('../build/bar', 'bar.c'))
+Default(env.Program('../build/bar', ['main.c', '../src2/blat.c', '../build/bar.lib']))
+""")
+
+test.write('src/foo.c', """
+int foo(void) 
+{ 
+    return 1;
+}
+""")
+
+test.write('src/bar.c', """
+__declspec(dllexport) int bar(void) 
+{ 
+    return 1;
+}
+""")
+
+test.write('src/main.c', """
+#include <bar.h>
+int main(void) 
+{ 
+    return 1;
+}
+""")
+
+test.write('src2/blat.c', """
+int blat(void) 
+{ 
+    return 1;
+}
+""")
+
+test.write('include/bar.h', """
+int foo(void);
+int blat(void);
+int bar(void);
+""")
+
+drive, rest = os.path.splitdrive(test.workpath('src'))
+
+drive_upper = string.upper(drive)
+drive_lower = string.lower(drive)
+rest_upper = rest[0] + string.upper(rest[1]) + rest[2:]
+rest_lower = rest[0] + string.lower(rest[1]) + rest[2:]
+
+combinations = [
+    os.path.join(drive_upper, rest_upper),
+    os.path.join(drive_upper, rest_lower),
+    os.path.join(drive_lower, rest_upper),
+    os.path.join(drive_lower, rest_lower),
+]
+
+test.run(chdir=combinations[0])
+
+for dir in combinations[1:]:
+    test.run(chdir=dir, stdout=test.wrap_stdout("""\
+scons: .* is up to date.
+scons: .* is up to date.
+scons: .* is up to date.
+"""))
+
+
+
+test.write('SConstruct', """
+env=Environment()
+env.StaticLibrary('a', 'a.c')
+env.StaticLibrary('b', 'b.c')
+""")
+
+test.write('a.c', '''
+#include "a.h"
+#include "b.h"
+''')
+
+test.write('b.c', '''
+#include "a.h"
+#include "B.h"
+''')
+
+test.write('a.h', """
+#define A_H
+""")
+
+test.write('b.h', """
+#define B_H
+""")
+
+test.run(arguments='a.lib b.lib')
+test.run(arguments='b.lib a.lib', stdout=test.wrap_stdout("""\
+scons: .* is up to date.
+scons: .* is up to date.
+"""))
+
+
+
+test.pass_test()
+

test/default-drive.py

-#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-"""
-This test verifies (on Windows systems) that specifying an
-absolute path name without a drive letter uses the SConstruct
-file's drive as the default.
-"""
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-import os
-import os.path
-import string
-import sys
-
-import TestSCons
-
-test = TestSCons.TestSCons()
-
-if sys.platform != 'win32':
-    test.pass_test()
-
-test.subdir('src')
-
-test.write(['src', 'SConstruct'], """
-def cat(env, source, target):
-    target = str(target[0])
-    source = map(str, source)
-    f = open(target, "wb")
-    for src in source:
-        f.write(open(src, "rb").read())
-    f.close()
-
-env = Environment(BUILDERS={'Build':Builder(action=cat)})
-env.Build('../build/file.out', 'file.in')
-""")
-
-test.write(['src', 'file.in'], "src/file.in\n")
-
-build_file_out = test.workpath('build', 'file.out')
-
-print os.path.splitdrive(build_file_out)[1]
-test.run(chdir = 'src',
-         arguments = os.path.splitdrive(build_file_out)[1])
-
-test.must_match(['build', 'file.out'], "src/file.in\n")
-
-test.pass_test()

test/mingw.py

-"""
-This tests the MinGW C/C++ compiler support.
-"""
-
-#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-import TestSCons
-import sys
-import os.path
-import os
-import TestCmd
-import time
-import string
-
-test = TestSCons.TestSCons(match = TestCmd.match_re_dotall)
-
-# MinGW is Windows only:
-if sys.platform != 'win32':
-    msg = "Skipping mingw test on non-Windows platform '%s'\n" % sys.platform
-    test.skip_test(msg)
-
-# This test requires MinGW to be installed:
-test.write('SConstruct',"""
-from SCons.Tool.mingw import exists
-import sys
-env = Environment()
-if exists(env):
-    print 'mingw exists'
-sys.exit(0)
-""")
-
-test.run()
-if string.find(test.stdout(), 'mingw exists') == -1:
-    test.skip_test("No MinGW on this system, skipping test.\n")
-
-test.subdir('header')
-
-# Do the actual testing:
-test.write('SConstruct',"""
-env=Environment(tools=['mingw'])
-assert env['CC'] == 'gcc'
-env.StaticLibrary('static', 'static.cpp')
-env.SharedLibrary('shared', 'shared.cpp')
-env.SharedLibrary('cshared', ['cshared.c', 'cshared.def'])
-env.Program('test', ['test.cpp', env.RES('resource.rc', CPPPATH=['header'])], LIBS=['static', 'shared', 'cshared'], LIBPATH=['.'])
-""")
-
-test.write('test.cpp', '''
-#include <stdio.h>
-#include <windows.h>
-#include "resource.h"
-
-void shared_func(void);
-void static_func(void);
-extern "C" void cshared_func(void);
-
-int main(void) 
-{ 
-    printf("%s\\n", "test.cpp");
-    shared_func();
-    static_func();
-    cshared_func();
-
-    char test[1024];
-    LoadString(GetModuleHandle(NULL), IDS_TEST, test, sizeof(test));
-    printf("%d %s\\n", IDS_TEST, test);
-
-    return 0;
-}
-''')
-
-test.write('resource.rc', '''
-#include "resource.h"
-#include <resource2.h>
-
-STRINGTABLE DISCARDABLE 
-BEGIN
-    IDS_TEST RESOURCE_RC
-END
-''')
-
-test.write('resource.h', '''
-#define IDS_TEST 2001
-''')
-
-test.write('static.cpp', '''
-#include <stdio.h>
-
-void static_func(void)
-{
-    printf("%s\\n", "static.cpp");
-}
-''')
-
-test.write('shared.cpp', '''
-#include <stdio.h>
-
-void shared_func(void)
-{
-    printf("%s\\n", "shared.cpp");
-}
-''')
-
-test.write('cshared.c', '''
-#include <stdio.h>
-
-void cshared_func(void)
-{
-    printf("%s\\n", "cshared.c");
-}
-''')
-
-test.write('cshared.def', '''
-EXPORTS
-cshared_func
-''')
-
-
-
-test.write('header/resource2.h', '''
-#define RESOURCE_RC "resource.rc"
-''')
-
-# the mingw linker likes to print "Creating library file: libfoo.a" to stderr, but
-# we'd like for this test to pass once this bug is fixed, so match anything at all
-# that comes out of stderr:
-test.run(arguments='test.exe', stderr='.*')
-# ensure the source def for cshared.def got used, and there wasn't a target def for chshared.dll:
-test.fail_test(string.find(test.stdout(), 'cshared.def') == -1)
-test.fail_test(string.find(test.stdout(), '-Wl,--output-def,cshared.def') != -1)
-# ensure the target def got generated for the shared.dll:
-test.fail_test(not os.path.exists(test.workpath('shared.def')))
-test.run(program=test.workpath('test.exe'), stdout='test.cpp\nshared.cpp\nstatic.cpp\ncshared.c\n2001 resource.rc\n')
-
-# ensure that modifying the header causes the resource to be rebuilt:
-test.write('resource.h', '''
-#define IDS_TEST 2002
-''')
-test.run(arguments='test.exe', stderr='.*')
-test.run(program=test.workpath('test.exe'), stdout='test.cpp\nshared.cpp\nstatic.cpp\ncshared.c\n2002 resource.rc\n')
-
-# Test with specifying the default tool to make sure msvc setting doen't ruin it
-# for mingw:
-test.write('SConstruct',"""
-env=Environment(tools=['default', 'mingw'])
-assert env['CC'] == 'gcc'
-env.SharedLibrary('shared', 'shared.cpp')
-env.Program('test', 'test.cpp', LIBS=['static', 'shared', 'cshared'], LIBPATH=['.'])
-""")
-
-test.write('test.cpp', '''
-#include <stdio.h>
-
-void shared_func(void);
-
-int main(void) 
-{ 
-    printf("%s\\n", "test.cpp2");
-    shared_func();
-    return 0;
-}
-''')
-
-test.write('shared.cpp', '''
-#include <stdio.h>
-
-void shared_func(void)
-{
-    printf("%s\\n", "shared.cpp2");
-}
-''')
-
-# the mingw linker likes to print "Creating library file: libfoo.a" to stderr, but
-# we'd like for this test to pass once this bug is fixed, so match anything at all
-# that comes out of stderr:
-test.run(arguments='test.exe', stderr='.*')
-test.run(program=test.workpath('test.exe'), stdout='test.cpp2\nshared.cpp2\n')
-
-test.pass_test()

test/win32pathmadness.py

-#!/usr/bin/env python
-#
-# __COPYRIGHT__
-#
-# Permission is hereby granted, free of charge, to any person obtaining
-# a copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, sublicense, and/or sell copies of the Software, and to
-# permit persons to whom the Software is furnished to do so, subject to
-# the following conditions:
-#
-# The above copyright notice and this permission notice shall be included
-# in all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-
-"""
-This test verifies that the build command signatures do not depend on
-the case of the drive letter on Windows. This is important because Windows is 
-inconsistent about which case is used for the drive letter.
-"""
-
-__revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-
-import TestSCons
-import sys
-import TestCmd
-import string
-import os.path
-
-test = TestSCons.TestSCons(match=TestCmd.match_re)
-
-if sys.platform != 'win32':
-    msg = "Skipping Windows path tests on non-Windows platform '%s'\n" % sys.platform
-    test.skip_test(msg)
-
-test.subdir('src', 'build', 'include', 'src2')
-
-test.write('src/SConstruct', """
-env=Environment(LIBS=['../build/foo'], CPPPATH=['../include'], CCCOM='$CC $CCFLAGS $CPPFLAGS $_CPPINCFLAGS /c ${SOURCES.abspath} /Fo$TARGET')
-foo=env.Object('../build/foo', 'foo.c')
-Default(env.Library('../build/foo', foo))
-Default(env.SharedLibrary('../build/bar', 'bar.c'))
-Default(env.Program('../build/bar', ['main.c', '../src2/blat.c', '../build/bar.lib']))
-""")
-
-test.write('src/foo.c', """
-int foo(void) 
-{ 
-    return 1;
-}
-""")
-
-test.write('src/bar.c', """
-__declspec(dllexport) int bar(void) 
-{ 
-    return 1;
-}
-""")
-
-test.write('src/main.c', """
-#include <bar.h>
-int main(void) 
-{ 
-    return 1;
-}
-""")
-
-test.write('src2/blat.c', """
-int blat(void) 
-{ 
-    return 1;
-}
-""")
-
-test.write('include/bar.h', """
-int foo(void);
-int blat(void);
-int bar(void);
-""")
-
-drive, rest = os.path.splitdrive(test.workpath('src'))
-
-drive_upper = string.upper(drive)
-drive_lower = string.lower(drive)
-rest_upper = rest[0] + string.upper(rest[1]) + rest[2:]
-rest_lower = rest[0] + string.lower(rest[1]) + rest[2:]
-
-combinations = [
-    os.path.join(drive_upper, rest_upper),
-    os.path.join(drive_upper, rest_lower),
-    os.path.join(drive_lower, rest_upper),
-    os.path.join(drive_lower, rest_lower),
-]
-
-test.run(chdir=combinations[0])
-
-for dir in combinations[1:]:
-    test.run(chdir=dir, stdout=test.wrap_stdout("""\
-scons: .* is up to date.
-scons: .* is up to date.
-scons: .* is up to date.
-"""))
-
-
-
-test.write('SConstruct', """
-env=Environment()
-env.StaticLibrary('a', 'a.c')
-env.StaticLibrary('b', 'b.c')
-""")
-
-test.write('a.c', '''
-#include "a.h"
-#include "b.h"
-''')
-
-test.write('b.c', '''
-#include "a.h"
-#include "B.h"
-''')
-
-test.write('a.h', """
-#define A_H
-""")
-
-test.write('b.h', """
-#define B_H
-""")
-
-test.run(arguments='a.lib b.lib')
-test.run(arguments='b.lib a.lib', stdout=test.wrap_stdout("""\
-scons: .* is up to date.
-scons: .* is up to date.
-"""))
-
-
-
-test.pass_test()
-
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.