Commits

Rob Managan committed 0779b68 Merge

merge in changes from SCons default

  • Participants
  • Parent commits 025dcd2, ff3917f

Comments (0)

Files changed (19)

QMTest/TestSCons_time.py

 
         TestCommon.__init__(self, **kw)
 
-        # Now that the testing object has been set up, check if we should
-        # skip the test due to the Python version.  We need to be able to
-        # import __future__ (which scons-time.py uses for nested scopes)
-        # and to handle list comprehensions (just because we're avoiding
-        # the old map() and filter() idioms).
-
-        try:
-            import __future__
-        except ImportError:
-            version = sys.version.split()[0]
-            msg = 'scons-time does not work on Python version %s\n' % version
-            self.skip_test(msg)
-
-        try:
-            eval('[x for x in [1, 2]]')
-        except SyntaxError:
-            version = sys.version.split()[0]
-            msg = 'scons-time does not work on Python version %s\n' % version
-            self.skip_test(msg)
-
     def archive_split(self, path):
         if path[-7:] == '.tar.gz':
             return path[:-7], path[-7:]
 \... and many others.
 
 __COPYRIGHT__
+

admin/.aeignore

-*,D
-*.pyc
-.*.swp
-.consign
-.sconsign
     e = os.path.join('#src', 'engine')
     manifest_in = File(os.path.join(e, 'MANIFEST.in')).rstr()
     sources = [x[:-1] for x in open(manifest_in).readlines()]
-    sources = [x for x in sources if x.find('Optik') == -1]
     sources = [x for x in sources if x.find('Platform') == -1]
     sources = [x for x in sources if x.find('Tool') == -1]
     # XXX
 else:
     has_subprocess = False
     # Set up lowest-common-denominator spawning of a process on both Windows
-    # and non-Windows systems that works all the way back to Python 1.5.2.
-    try:
-        os.spawnv
-    except AttributeError:
-        def spawn_it(command_args):
-            pid = os.fork()
-            if pid == 0:
-                os.execv(command_args[0], command_args)
-            else:
-                pid, status = os.waitpid(pid, 0)
-                return (None, None, status >> 8)
-    else:
-        def spawn_it(command_args):
-            command = command_args[0]
-            command_args = [escape(c) for c in command_args]
-            return (None, None, os.spawnv(os.P_WAIT, command, command_args))
+    # and non-Windows systems that works all the way back to Python 1.6
+    def spawn_it(command_args):
+        command = command_args[0]
+        command_args = [escape(c) for c in command_args]
+        return (None, None, os.spawnv(os.P_WAIT, command, command_args))
 
 class Base(object):
     def __init__(self, path, spe=None):
 the scons-users mailing list.
 
 
-RELEASE 2.2.0 - Mon, 09 Sep 2011 20:54:57 -0700
+RELEASE 2.2.0 - Mon, 05 Aug 2012 15:37:48 +0000
 
   Please consult the RELEASE.txt file for a summary of changes since the last
   release and consult the CHANGES.txt file for complete a list of changes
 
 RELEASE 2.X.X - 
 
+  From Anatoly Techtonik:
+    - Added ability to run scripts/scons.py directly from source checkout
+    - Hide deprecated --debug={dtree,stree,tree} from --help output
+    - Error messages from option parser now include hints about valid choices
+
+  From Juan Lang:
+    - Fix WiX Tool to use .wixobj rather than .wxiobj for compiler output
+    - Support building with WiX releases after 2.0
+
   From Alexey Klimkin:
     - Fix nested LIBPATH expansion by flattening sequences in subst_path.
 
   - Add a new AddOption() function to support user-defined command-
     line flags (like --prefix=, --force, etc.).
 
+  - Replace modified Optik version with new optparse compatibility module
+    for command line processing in Scripts/SConsOptions.py
+
   - Push and retrieve built symlinks to/from a CacheDir() as actual
     symlinks, not by copying the file contents.
 

src/engine/SCons/Optik/.aeignore

-*,D
-*.pyc
-.*.swp
-.consign
-.sconsign

src/engine/SCons/Script/SConsOptions.py

     preserve_unknown_options = False
 
     def error(self, msg):
+        # overriden OptionValueError exception handler
         self.print_usage(sys.stderr)
-        sys.stderr.write("SCons error: %s\n" % msg)
+        sys.stderr.write("SCons Error: %s\n" % msg)
         sys.exit(2)
 
     def _process_long_opt(self, rargs, values):
                   action="store_true",
                   help="Print build actions for files from CacheDir.")
 
+    def opt_invalid(group, value, options):
+        errmsg  = "`%s' is not a valid %s option type, try:\n" % (value, group)
+        return errmsg + "    %s" % ", ".join(options)
+
     config_options = ["auto", "force" ,"cache"]
 
     def opt_config(option, opt, value, parser, c_options=config_options):
         if not value in c_options:
-            raise OptionValueError("Warning:  %s is not a valid config type" % value)
+            raise OptionValueError(opt_invalid('config', value, c_options))
         setattr(parser.values, option.dest, value)
     opt_config_help = "Controls Configure subsystem: %s." \
                       % ", ".join(config_options)
     debug_options = ["count", "duplicate", "explain", "findlibs",
                      "includes", "memoizer", "memory", "objects",
                      "pdb", "prepare", "presub", "stacktrace",
-                     "time"] + list(deprecated_debug_options.keys())
+                     "time"]
 
     def opt_debug(option, opt, value, parser,
                   debug_options=debug_options,
                   deprecated_debug_options=deprecated_debug_options):
         if value in debug_options:
             parser.values.debug.append(value)
-            if value in deprecated_debug_options.keys():
-                try:
-                    parser.values.delayed_warnings
-                except AttributeError:
-                    parser.values.delayed_warnings = []
-                msg = deprecated_debug_options[value]
-                w = "The --debug=%s option is deprecated%s." % (value, msg)
-                t = (SCons.Warnings.DeprecatedDebugOptionsWarning, w)
-                parser.values.delayed_warnings.append(t)
+        elif value in deprecated_debug_options.keys():
+            parser.values.debug.append(value)
+            try:
+                parser.values.delayed_warnings
+            except AttributeError:
+                parser.values.delayed_warnings = []
+            msg = deprecated_debug_options[value]
+            w = "The --debug=%s option is deprecated%s." % (value, msg)
+            t = (SCons.Warnings.DeprecatedDebugOptionsWarning, w)
+            parser.values.delayed_warnings.append(t)
         else:
-            raise OptionValueError("Warning:  %s is not a valid debug type" % value)
+            raise OptionValueError(opt_invalid('debug', value, debug_options))
     opt_debug_help = "Print various types of debugging information: %s." \
                      % ", ".join(debug_options)
     op.add_option('--debug',
         try:
             diskcheck_value = diskcheck_convert(value)
         except ValueError, e:
-            raise OptionValueError("Warning: `%s' is not a valid diskcheck type" % e)
+            raise OptionValueError("`%s' is not a valid diskcheck type" % e)
         setattr(parser.values, option.dest, diskcheck_value)
 
     op.add_option('--diskcheck',
 
     def opt_duplicate(option, opt, value, parser):
         if not value in SCons.Node.FS.Valid_Duplicates:
-            raise OptionValueError("`%s' is not a valid duplication style." % value)
+            raise OptionValueError(opt_invalid('duplication', value,
+                                              SCons.Node.FS.Valid_Duplicates))
         setattr(parser.values, option.dest, value)
         # Set the duplicate style right away so it can affect linking
         # of SConscript files.
             elif o == 'status':
                 tp.status = True
             else:
-                raise OptionValueError("Warning:  %s is not a valid --tree option" % o)
+                raise OptionValueError(opt_invalid('--tree', o, tree_options))
         parser.values.tree_printers.append(tp)
 
     opt_tree_help = "Print a dependency tree in various formats: %s." \

src/engine/SCons/Script/SConscript.py

 
     def EnsurePythonVersion(self, major, minor):
         """Exit abnormally if the Python version is not late enough."""
-        try:
-            v_major, v_minor, v_micro, release, serial = sys.version_info
-            python_ver = (v_major, v_minor)
-        except AttributeError:
-            python_ver = self._get_major_minor_revision(sys.version)[:2]
-        if python_ver < (major, minor):
-            v = sys.version.split(" ", 1)[0]
+        if sys.version_info < (major, minor):
+            v = sys.version.split()[0]
             print "Python %d.%d or greater required, but you have Python %s" %(major,minor,v)
             sys.exit(2)
 

src/engine/SCons/Tool/wix.py

 
     env['WIXLIGHTFLAGS'].append( '-nologo' )
     env['WIXLIGHTCOM'] = "$WIXLIGHT $WIXLIGHTFLAGS -out ${TARGET} ${SOURCES}"
+    env['WIXSRCSUF'] = '.wxs'
+    env['WIXOBJSUF'] = '.wixobj'
 
     object_builder = SCons.Builder.Builder(
         action      = '$WIXCANDLECOM',
-        suffix      = '.wxiobj',
-        src_suffix  = '.wxs')
+        suffix      = '$WIXOBJSUF',
+        src_suffix  = '$WIXSRCSUF')
 
     linker_builder = SCons.Builder.Builder(
         action      = '$WIXLIGHTCOM',
-        src_suffix  = '.wxiobj',
+        src_suffix  = '$WIXOBJSUF',
         src_builder = object_builder)
 
     env['BUILDERS']['WiX'] = linker_builder
 
     # try to find the candle.exe and light.exe tools and 
     # add the install directory to light libpath.
-    #for path in os.environ['PATH'].split(os.pathsep):
     for path in os.environ['PATH'].split(os.pathsep):
         if not path:
             continue
 
         # search for the tools in the PATH environment variable
         try:
-            if env['WIXCANDLE'] in os.listdir(path) and\
-               env['WIXLIGHT']  in os.listdir(path):
-                   env.PrependENVPath('PATH', path)
-                   env['WIXLIGHTFLAGS'] = [ os.path.join( path, 'wixui.wixlib' ),
-                                            '-loc',
-                                            os.path.join( path, 'WixUI_en-us.wxl' ) ]
-                   return 1
+            files = os.listdir(path)
+            if env['WIXCANDLE'] in files and env['WIXLIGHT'] in files:
+                env.PrependENVPath('PATH', path)
+                # include appropriate flags if running WiX 2.0
+                if 'wixui.wixlib' in files and 'WixUI_en-us.wxl' in files:
+                    env['WIXLIGHTFLAGS'] = [ os.path.join( path, 'wixui.wixlib' ),
+                                             '-loc',
+                                             os.path.join( path, 'WixUI_en-us.wxl' ) ]
+                else:
+                    env['WIXLIGHTFLAGS'] = []
+                return 1
         except OSError:
             pass # ignore this, could be a stale PATH entry.
 

src/engine/SCons/Tool/wixTests.py

+#
+# __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 unittest
+import os.path
+import os
+import sys
+
+import SCons.Errors
+from SCons.Tool.wix import *
+from SCons.Environment import Environment
+
+import TestCmd
+
+# create fake candle and light, so the tool's exists() method will succeed
+test = TestCmd.TestCmd(workdir = '')
+test.write('candle.exe', 'rem this is candle')
+test.write('light.exe', 'rem this is light')
+os.environ['PATH'] += os.pathsep + test.workdir
+
+class WixTestCase(unittest.TestCase):
+    def test_vars(self):
+        """Test that WiX tool adds vars"""
+        env = Environment(tools=['wix'])
+        assert env['WIXCANDLE'] is not None
+        assert env['WIXCANDLEFLAGS'] is not None
+        assert env['WIXLIGHTFLAGS'] is not None
+        assert env.subst('$WIXOBJSUF') == '.wixobj'
+        assert env.subst('$WIXSRCSUF') == '.wxs'
+
+if __name__ == "__main__":
+    suite = unittest.makeSuite(WixTestCase, 'test_')
+    if not unittest.TextTestRunner().run(suite).wasSuccessful():
+        sys.exit(1)
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:

src/engine/SCons/compat/_scons_builtins.py

 
         all()
         any()
-        sorted()
         memoryview()
 
 Implementations of functions are *NOT* guaranteed to be fully compliant
                 return self.obj[indx]
     builtins.memoryview = memoryview
 
-try:
-    sorted
-except NameError:
-    # Pre-2.4 Python has no sorted() function.
-    #
-    # The pre-2.4 Python list.sort() method does not support
-    # list.sort(key=) nor list.sort(reverse=) keyword arguments, so
-    # we must implement the functionality of those keyword arguments
-    # by hand instead of passing them to list.sort().
-    def sorted(iterable, cmp=None, key=None, reverse=False):
-        if key is not None:
-            result = [(key(x), x) for x in iterable]
-        else:
-            result = iterable[:]
-        if cmp is None:
-            # Pre-2.3 Python does not support list.sort(None).
-            result.sort()
-        else:
-            result.sort(cmp)
-        if key is not None:
-            result = [t1 for t0,t1 in result]
-        if reverse:
-            result.reverse()
-        return result
-    builtins.sorted = sorted
-
-#if sys.version_info[:3] in ((2, 2, 0), (2, 2, 1)):
-#    def lstrip(s, c=string.whitespace):
-#        while s and s[0] in c:
-#            s = s[1:]
-#        return s
-#    def rstrip(s, c=string.whitespace):
-#        while s and s[-1] in c:
-#            s = s[:-1]
-#        return s
-#    def strip(s, c=string.whitespace, l=lstrip, r=rstrip):
-#        return l(r(s, c), c)
-#
-#    object.__setattr__(str, 'lstrip', lstrip)
-#    object.__setattr__(str, 'rstrip', rstrip)
-#    object.__setattr__(str, 'strip', strip)
-
 # Local Variables:
 # tab-width:4
 # indent-tabs-mode:nil

src/script/scons.py

 # engine modules if they're in either directory.
 
 
-# Check to see if the python version is > 3.0 which is currently unsupported
-# If so exit with error message
-try:
-    if  sys.version_info >= (3,0,0):
-        msg = "scons: *** SCons version %s does not run under Python version %s.\n\
-Python 3.0 and later are not yet supported.\n"
-        sys.stderr.write(msg % (__version__, sys.version.split()[0]))
-        sys.exit(1)
-except AttributeError:
-    # Pre-1.6 Python has no sys.version_info
-    # No need to check version as we then know the version is < 3.0.0 and supported
-    pass
+if sys.version_info >= (3,0,0):
+    msg = "scons: *** SCons version %s does not run under Python version %s.\n\
+Python 3 is not yet supported.\n"
+    sys.stderr.write(msg % (__version__, sys.version.split()[0]))
+    sys.exit(1)
+
 
 script_dir = sys.path[0]
 
 ##############################################################################
 
 if __name__ == "__main__":
-    import SCons.Script
+    try:
+        import SCons.Script
+    except:
+        ROOT = os.path.join(os.path.abspath(os.path.dirname(__file__)), '..', 'engine')
+        if os.path.exists(ROOT):
+            sys.path += [ROOT]
+            print("SCons import failed. Trying to run from source directory")
+        import SCons.Script
+  
     # this does all the work, and calls sys.exit
     # with the proper exit status when done.
     SCons.Script.main()

test/Deprecated/SourceCode/Perforce/Perforce.py

             # We don't use self.run() because the TestCmd logic will hang
             # waiting for the daemon to exit, even when we pass it
             # the -d option.
-            try:
-                spawnv = os.spawnv
-            except AttributeError:
-                os.system(' '.join(args))
-            else:
-                spawnv(os.P_NOWAIT, self.p4d, args)
-                self.sleep(2)
+            os.spawnv(os.P_NOWAIT, self.p4d, args)
+            self.sleep(2)
         else:
             import socket
             s = socket.socket()

test/EnsurePythonVersion.py

 
 test.run(status=2)
 
-test.write('SConstruct', """\
-import sys
-try:
-    delattr(sys, 'version_info')
-except AttributeError:
-    pass
-sys.version = '2.3b1 (#0, Feb 24 2003, 19:13:11)\\n'
-EnsurePythonVersion(1,3)
-Exit(0)
-""")
-
-test.run()
-
-test.write('SConstruct', """\
-import sys
-try:
-    delattr(sys, 'version_info')
-except AttributeError:
-    pass
-sys.version = '2.3+ (#0, Feb 24 2003, 19:13:11)\\n'
-EnsurePythonVersion(2,2)
-Exit(0)
-""")
-
-test.run()
-
-test.write('SConstruct', """\
-import sys
-try:
-    delattr(sys, 'version_info')
-except AttributeError:
-    pass
-sys.version = '2.3b1 (#0, Feb 24 2003, 19:13:11)\\n'
-EnsurePythonVersion(2,3)
-Exit(0)
-""")
-
-test.run()
-
-test.write('SConstruct', """\
-import sys
-try:
-    delattr(sys, 'version_info')
-except AttributeError:
-    pass
-sys.version = '2.3b1 (#0, Feb 24 2003, 19:13:11)\\n'
-EnsurePythonVersion(2,4)
-Exit(0)
-""")
-
-test.run(status=2)
-
 
 
 test.pass_test()

test/option--duplicate.py

 test.run(arguments='--duplicate=nonsense', status=2, stderr="""\
 usage: scons [OPTION] [TARGET] ...
 
-SCons error: `nonsense' is not a valid duplication style.
+SCons Error: `nonsense' is not a valid duplication option type, try:
+    hard-soft-copy, soft-hard-copy, hard-copy, soft-copy, copy
 """)
 
 test.pass_test()

test/option--tree.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__"
+
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.write('SConstruct', "")
+
+test.run(arguments = '-Q --tree=prune',
+         stdout = """scons: `.' is up to date.
++-.
+  +-SConstruct
+""")
+
+test.run(arguments = '-Q --tree=foofoo',
+         stderr = """usage: scons [OPTION] [TARGET] ...
+
+SCons Error: `foofoo' is not a valid --tree option type, try:
+    all, derived, prune, status
+""",
+         status = 2)
+
+test.run(arguments = '--debug=tree',
+         stderr = """
+scons: warning: The --debug=tree option is deprecated; please use --tree=all instead.
+.*
+""",
+         status = 0, match=TestSCons.match_re_dotall)
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4:

test/option-unknown.py

 test.run(arguments = '-Z',
          stderr = """usage: scons [OPTION] [TARGET] ...
 
-SCons error: no such option: -Z
+SCons Error: no such option: -Z
 """,
          status = 2)
 
 test.run(arguments = '--ZizzerZazzerZuzz',
          stderr = """usage: scons [OPTION] [TARGET] ...
 
-SCons error: no such option: --ZizzerZazzerZuzz
+SCons Error: no such option: --ZizzerZazzerZuzz
 """,
          status = 2)