$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
From: jurko.gospodnetic_at_[hidden]
Date: 2008-01-05 15:37:45
Author: jurko
Date: 2008-01-05 15:37:44 EST (Sat, 05 Jan 2008)
New Revision: 42497
URL: http://svn.boost.org/trac/boost/changeset/42497
Log:
Minor stylistic changes - cleaned up import calls, wrapped much text at 80 characters updated comments, typo corrections, removed trailing spaces, etc.
Text files modified: 
   trunk/tools/build/v2/build-system.jam         |    12                                         
   trunk/tools/build/v2/build/build-request.jam  |   185 +++++++-------                          
   trunk/tools/build/v2/build/project.jam        |    42 +-                                      
   trunk/tools/build/v2/build/targets.jam        |    12                                         
   trunk/tools/build/v2/build/type.jam           |     2                                         
   trunk/tools/build/v2/build/version.jam        |     8                                         
   trunk/tools/build/v2/build/virtual-target.jam |   511 ++++++++++++++++++--------------------- 
   trunk/tools/build/v2/kernel/errors.jam        |   132 +++++-----                              
   trunk/tools/build/v2/kernel/modules.jam       |   195 +++++++-------                          
   trunk/tools/build/v2/test/BoostBuild.py       |   310 +++++++++++------------                 
   trunk/tools/build/v2/test/alias.py            |    35 +-                                      
   trunk/tools/build/v2/tools/qt4.jam            |    48 ++-                                     
   12 files changed, 728 insertions(+), 764 deletions(-)
Modified: trunk/tools/build/v2/build-system.jam
==============================================================================
--- trunk/tools/build/v2/build-system.jam	(original)
+++ trunk/tools/build/v2/build-system.jam	2008-01-05 15:37:44 EST (Sat, 05 Jan 2008)
@@ -4,13 +4,11 @@
 # Distributed under the Boost Software License, Version 1.0.
 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 
-# This file is part of Boost.Build version 2.  You can think of it as
-# forming the main() routine.  It is invoked by the bootstrapping code
-# in bootstrap.jam.
-#
-# The version of bootstrap.jam invoking this lives in
-# tools/build/kernel until BBv1 is retired, so that BBv1 can have its
-# bootstrap.jam in this directory.
+# This file is part of Boost Build version 2. You can think of it as forming the
+# the main() routine. It is invoked by the bootstrapping code in bootstrap.jam.
+#
+# The version of bootstrap.jam invoking this lives in tools/build/kernel until
+# BBv1 is retired, so that BBv1 can have its bootstrap.jam in this directory.
 
 import project ;
 import targets ;
Modified: trunk/tools/build/v2/build/build-request.jam
==============================================================================
--- trunk/tools/build/v2/build/build-request.jam	(original)
+++ trunk/tools/build/v2/build/build-request.jam	2008-01-05 15:37:44 EST (Sat, 05 Jan 2008)
@@ -2,16 +2,16 @@
 # Distributed under the Boost Software License, Version 1.0.
 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 
+import "class" : new ;
 import sequence ;
 import set ;
 import regex ;
 import feature ;
 import property ;
-import numbers ;
 import container ;
-import "class" : new ;
 import string ;
 
+
 # Transform property-set by applying f to each component property.
 local rule apply-to-property-set ( f property-set )
 {
@@ -19,22 +19,25 @@
     return [ string.join [ $(f) $(properties) ] : / ] ;
 }
 
-# expand the given build request by combining all property-sets which don't
-# specify conflicting non-free features.
+
+# Expand the given build request by combining all property-sets which don't
+# specify conflicting non-free features. Expects all the project files to
+# already be loaded.
 rule expand-no-defaults ( property-sets * )
 {
-    # First make all features and subfeatures explicit
-    local expanded-property-sets = [ 
-      sequence.transform apply-to-property-set feature.expand-subfeatures
-        : $(property-sets) ] ;
-    
+    # First make all features and subfeatures explicit.
+    local expanded-property-sets = [ sequence.transform apply-to-property-set
+        feature.expand-subfeatures : $(property-sets) ] ;
+
     # Now combine all of the expanded property-sets
     local product = [ x-product $(expanded-property-sets) : $(feature-space) ] ;
-    
+
     return $(product) ;
 }
 
-# implementaiton of x-product, below
+
+# Implementation of x-product, below. Expects all the project files to already
+# be loaded.
 local rule x-product-aux ( property-sets + )
 {
     local result ;
@@ -46,58 +49,60 @@
     {
         local x-product-seen ;
         {
-            # don't mix in any conflicting features
+            # Don't mix in any conflicting features.
             local x-product-used = $(x-product-used) $(f) ;
-            
+
             if $(property-sets[2])
             {
                 local rest = [ x-product-aux $(property-sets[2-]) : $(feature-space) ] ;
                 result = $(property-sets[1])/$(rest) ;
             }
-            
+
             result ?= $(property-sets[1]) ;
         }
-        
-        # If we didn't encounter a conflicting feature lower down,
-        # don't recurse again.
+
+        # If we didn't encounter a conflicting feature lower down, don't recurse
+        # again.
         if ! [ set.intersection $(f) : $(x-product-seen) ]
         {
             property-sets = ;
         }
-        
+
         seen = $(x-product-seen) ;
     }
-    
+
     if $(property-sets[2])
     {
         result += [ x-product-aux $(property-sets[2-]) : $(feature-space) ] ;
     }
-    
-    # Note that we've seen these features so that higher levels will
-    # recurse again without them set.
+
+    # Note that we've seen these features so that higher levels will recurse
+    # again without them set.
     x-product-seen += $(f) $(seen) ;
     return $(result) ;
 }
 
-# Return the cross-product of all elements of property-sets, less any
-# that would contain conflicting values for single-valued features.
+
+# Return the cross-product of all elements of property-sets, less any that would
+# contain conflicting values for single-valued features. Expects all the project
+# files to already be loaded.
 local rule x-product ( property-sets * )
 {
     if $(property-sets).non-empty
     {
-        # prepare some "scoped globals" that can be used by the
-        # implementation function, x-product-aux.
+        # Prepare some "scoped globals" that can be used by the implementation
+        # function, x-product-aux.
         local x-product-seen x-product-used ;
         return [ x-product-aux $(property-sets) : $(feature-space) ] ;
     }
-    # otherwise return empty
+    # Otherwise return empty.
 }
 
-# Returns true if 'v' is either implicit value, or
-# the part before the first '-' symbol is implicit value
+
+# Returns true if either 'v' or the part of 'v' before the first '-' symbol is
+# an implicit value. Expects all the project files to already be loaded.
 local rule looks-like-implicit-value ( v )
 {
-    
     if [ feature.is-implicit-value $(v) ]
     {
         return true ;
@@ -108,16 +113,16 @@
         if [ feature.is-implicit-value $(split[1]) ]
         {
             return true ;
-        }        
+        }
     }
 }
 
 
-# Takes the command line tokens (such as taken from ARGV rule) and constructs
-# build request from it.
-# Returns a vector of two vectors (where "vector" means container.jam's "vector"). 
-# First is the set of targets specified in the command line, and second is
-# the set of requested build properties. 
+# Takes the command line tokens (such as taken from the ARGV rule) and
+# constructs a build request from them. Returns a vector of two vectors (where
+# "vector" means container.jam's "vector"). First is the set of targets
+# specified in the command line, and second is the set of requested build
+# properties. Expects all the project files to already be loaded.
 rule from-command-line ( command-line * )
 {
     local targets ;
@@ -131,15 +136,16 @@
         {
             skip-next = ;
         }
-        else if ! [ MATCH "^(-).*" : $(e) ] 
+        else if ! [ MATCH "^(-).*" : $(e) ]
         {
-            # Build request spec either has "=" in it, or completely
-            # consists of implicit feature values.
+            # Build request spec either has "=" in it or completely consists of
+            # implicit feature values.
             local fs = feature-space ;
-            if [ MATCH "(.*=.*)" : $(e) ] 
-               || [ looks-like-implicit-value $(e:D=) : $(feature-space) ] 
+            if [ MATCH "(.*=.*)" : $(e) ]
+                || [ looks-like-implicit-value $(e:D=) : $(feature-space) ]
             {
-                properties += [ convert-command-line-element $(e) : $(feature-space) ] ;
+                properties += [ convert-command-line-element $(e)
+                    : $(feature-space) ] ;
             }
             else
             {
@@ -151,24 +157,27 @@
             skip-next = true ;
         }
     }
-    return [ new vector [ new vector $(targets) ] [ new vector $(properties) ] ] ;
+    return [ new vector
+        [ new vector $(targets) ]
+        [ new vector $(properties) ] ] ;
 }
 
-# Converts one element of command line build request specification into
-# internal form.
+
+# Converts one element of command line build request specification into internal
+# form. Expects all the project files to already be loaded.
 local rule convert-command-line-element ( e )
 {
     local result ;
     local parts = [ regex.split $(e) "/" ] ;
-    for local p in $(parts) 
+    for local p in $(parts)
     {
         local m = [ MATCH "([^=]*)=(.*)" : $(p) ] ;
         local lresult ;
-        if $(m) 
+        if $(m)
         {
             local feature = $(m[1]) ;
-            local values = [ regex.split $(m[2]) "," ] ;            
-            lresult = <$(feature)>$(values) ;            
+            local values = [ regex.split $(m[2]) "," ] ;
+            lresult = <$(feature)>$(values) ;
         }
         else
         {
@@ -176,17 +185,16 @@
         }
 
         if ! [ MATCH (.*-.*) : $(p) ]
-        {          
-            # property.validate cannot handle subfeatures,
-            # so we avoid the check here.
+        {
+            # property.validate cannot handle subfeatures, so we avoid the check
+            # here.
             for local p in $(lresult)
             {
                 property.validate $(p) : $(feature-space) ;
             }
         }
-        
 
-        if ! $(result) 
+        if ! $(result)
         {
             result = $(lresult) ;
         }
@@ -194,17 +202,19 @@
         {
             result = $(result)/$(lresult) ;
         }
-    }  
-    
+    }
+
     return $(result) ;
 }
 
+
 rule __test__ ( )
 {
-    import assert feature ;
-    
+    import assert ;
+    import feature ;
+
     feature.prepare-test build-request-test-temp ;
-    
+
     import build-request ;
     import build-request : expand-no-defaults : build-request.expand-no-defaults ;
     import errors : try catch ;
@@ -222,56 +232,45 @@
 
     feature runtime-link : dynamic static : symmetric ;
 
-    # empty build requests should expand to empty.
+    # Empty build requests should expand to empty.
     assert.result
-      : build-request.expand-no-defaults
-      ;
+        : build-request.expand-no-defaults ;
 
     assert.result
-      <toolset>gcc/<toolset-gcc:version>3.0.1/<stdlib>stlport/<variant>debug
-      <toolset>msvc/<stdlib>stlport/<variant>debug
-      <toolset>msvc/<variant>debug 
-
-      : build-request.expand-no-defaults gcc-3.0.1/stlport msvc/stlport msvc debug
-      ;
+        <toolset>gcc/<toolset-gcc:version>3.0.1/<stdlib>stlport/<variant>debug
+        <toolset>msvc/<stdlib>stlport/<variant>debug
+        <toolset>msvc/<variant>debug
+        : build-request.expand-no-defaults gcc-3.0.1/stlport msvc/stlport msvc debug ;
 
     assert.result
-      <toolset>gcc/<toolset-gcc:version>3.0.1/<stdlib>stlport/<variant>debug
-      <toolset>msvc/<variant>debug 
-      <variant>debug/<toolset>msvc/<stdlib>stlport
-
-      : build-request.expand-no-defaults gcc-3.0.1/stlport msvc debug msvc/stlport
-      ;
+        <toolset>gcc/<toolset-gcc:version>3.0.1/<stdlib>stlport/<variant>debug
+        <toolset>msvc/<variant>debug
+        <variant>debug/<toolset>msvc/<stdlib>stlport
+        : build-request.expand-no-defaults gcc-3.0.1/stlport msvc debug msvc/stlport ;
 
     assert.result
-      <toolset>gcc/<toolset-gcc:version>3.0.1/<stdlib>stlport/<variant>debug/<inlining>off
-      <toolset>gcc/<toolset-gcc:version>3.0.1/<stdlib>stlport/<variant>release/<inlining>off
-
-      : build-request.expand-no-defaults gcc-3.0.1/stlport debug release <inlining>off
-      ;        
+        <toolset>gcc/<toolset-gcc:version>3.0.1/<stdlib>stlport/<variant>debug/<inlining>off
+        <toolset>gcc/<toolset-gcc:version>3.0.1/<stdlib>stlport/<variant>release/<inlining>off
+        : build-request.expand-no-defaults gcc-3.0.1/stlport debug release <inlining>off ;
 
     assert.result
-      <include>a/b/c/<toolset>gcc/<toolset-gcc:version>3.0.1/<stdlib>stlport/<variant>debug/<include>x/y/z
-      <include>a/b/c/<toolset>msvc/<stdlib>stlport/<variant>debug/<include>x/y/z
-      <include>a/b/c/<toolset>msvc/<variant>debug/<include>x/y/z 
-
-      : build-request.expand-no-defaults <include>a/b/c gcc-3.0.1/stlport msvc/stlport msvc debug  <include>x/y/z
-      ;
+        <include>a/b/c/<toolset>gcc/<toolset-gcc:version>3.0.1/<stdlib>stlport/<variant>debug/<include>x/y/z
+        <include>a/b/c/<toolset>msvc/<stdlib>stlport/<variant>debug/<include>x/y/z
+        <include>a/b/c/<toolset>msvc/<variant>debug/<include>x/y/z
+        : build-request.expand-no-defaults <include>a/b/c gcc-3.0.1/stlport msvc/stlport msvc debug  <include>x/y/z ;
 
     local r ;
 
-    r = [ build-request.from-command-line bjam debug runtime-link=dynamic ] ;              
+    r = [ build-request.from-command-line bjam debug runtime-link=dynamic ] ;
     assert.equal [ $(r).get-at 1 ] : ;
     assert.equal [ $(r).get-at 2 ] : debug <runtime-link>dynamic ;
 
     try ;
     {
-
         build-request.from-command-line bjam gcc/debug runtime-link=dynamic/static ;
     }
     catch \"static\" is not a value of an implicit feature ;
 
-
     r = [ build-request.from-command-line bjam -d2 --debug debug target runtime-link=dynamic ] ;
     assert.equal [ $(r).get-at 1 ] : target ;
     assert.equal [ $(r).get-at 2 ] : debug <runtime-link>dynamic ;
@@ -282,13 +281,13 @@
 
     r = [ build-request.from-command-line bjam debug gcc/runtime-link=dynamic,static ] ;
     assert.equal [ $(r).get-at 1 ] : ;
-    assert.equal [ $(r).get-at 2 ] : debug gcc/<runtime-link>dynamic 
-                 gcc/<runtime-link>static ;
+    assert.equal [ $(r).get-at 2 ] : debug gcc/<runtime-link>dynamic
+        gcc/<runtime-link>static ;
 
     r = [ build-request.from-command-line bjam msvc gcc,borland/runtime-link=static ] ;
     assert.equal [ $(r).get-at 1 ] : ;
-    assert.equal [ $(r).get-at 2 ] : msvc gcc/<runtime-link>static 
-                    borland/<runtime-link>static ;
+    assert.equal [ $(r).get-at 2 ] : msvc gcc/<runtime-link>static
+        borland/<runtime-link>static ;
 
     r = [ build-request.from-command-line bjam gcc-3.0 ] ;
     assert.equal [ $(r).get-at 1 ] : ;
@@ -296,5 +295,3 @@
 
     feature.finish-test build-request-test-temp ;
 }
-
-
Modified: trunk/tools/build/v2/build/project.jam
==============================================================================
--- trunk/tools/build/v2/build/project.jam	(original)
+++ trunk/tools/build/v2/build/project.jam	2008-01-05 15:37:44 EST (Sat, 05 Jan 2008)
@@ -25,10 +25,10 @@
 #  the project module.
 #
 #  There can also be 'standalone' projects. They are created by calling
-#  'initialize' on arbitrary module, and not specifying location. After the
-#  call, the module can call 'project' rule, declare main target and behave as
-#  regular projects. However, since it's not associated with any location, it's
-#  better declare only prebuilt targets.
+#  'initialize' on an arbitrary module, and not specifying location. After the
+#  call, the module can call the 'project' rule, declare main targets and behave
+#  as a regular project. However, since it's not associated with any location,
+#  it's better to declare only prebuilt targets.
 #
 #  The list of all loaded Jamfile is stored in variable .project-locations. It's
 #  possible to obtain module name for a location using 'module-name' rule. The
@@ -65,17 +65,18 @@
         # We want to make sure that child project are loaded only after parent
         # projects. In particular, because parent projects define attributes
         # which are inherited by children, and we don't want children to be
-        # loaded before parents has defined everything.
+        # loaded before parent has defined everything.
         #
         # While "build-project" and "use-project" can potentially refer to child
-        # projects from parent projects, we don't immediately loading child
+        # projects from parent projects, we don't immediately load child
         # projects when seeing those attributes. Instead, we record the minimal
-        # information that will be used only later.
+        # information to be used only later.
         load-used-projects $(module-name) ;
     }
     return $(module-name) ;
 }
 
+
 rule load-used-projects ( module-name )
 {
     local used = [ modules.peek $(module-name) : .used-projects ] ;
@@ -86,8 +87,7 @@
         local id = $(used[1]) ;
         local where = $(used[2]) ;
 
-        project.use $(id) : [ path.root
-            [ path.make $(where) ] $(location) ] ;
+        project.use $(id) : [ path.root [ path.make $(where) ] $(location) ] ;
         used = $(used[3-]) ;
     }
 }
@@ -276,7 +276,7 @@
 # twice with the same 'dir' is undefined.
 #
 local rule load-jamfile (
-    dir # The directory of the project Jamfile.
+    dir  # The directory of the project Jamfile.
     )
 {
     # See if the Jamfile is where it should be.
@@ -294,7 +294,7 @@
     # Initialize the jamfile module before loading.
     #
     initialize $(jamfile-module) : [ path.parent $(jamfile-to-load) ]
-      : $(jamfile-to-load:BS) ;
+        : $(jamfile-to-load:BS) ;
 
     local saved-project = $(.current-project) ;
     # Now load the Jamfile in it's own context. Initialization might have loaded
@@ -381,8 +381,8 @@
 #
 rule initialize (
     module-name   # The name of the project module.
-    : location ?  # The location (directory) of the project to initialize.
-                  # If not specified, a standalone project will be initialized.
+    : location ?  # The location (directory) of the project to initialize. If
+                  # not specified, a standalone project will be initialized.
     : basename ?
     )
 {
@@ -391,9 +391,9 @@
         ECHO "Initializing project '$(module-name)'" ;
     }
 
-    # TODO: need to consider if standalone projects can do anything but defining
-    # prebuilt targets. If so, we need to give more sensible "location", so that
-    # source paths are correct.
+    # TODO: need to consider if standalone projects can do anything but define
+    # prebuilt targets. If so, we need to give it a more sensible "location", so
+    # that source paths are correct.
     location ?= "" ;
     # Create the module for the Jamfile first.
     module $(module-name)
@@ -432,7 +432,7 @@
     }
     else
     {
-        # We search for parent/project-root only if jamfile was specified, i.e.
+        # We search for parent/project-root only if Jamfile was specified, i.e.
         # if the project is not standalone.
         if $(location) && ! [ MATCH ($(JAMROOT)) : $(basename) ]
         {
@@ -440,7 +440,7 @@
         }
         else
         {
-            # It's either jamroot, or standalone project. If it's jamroot,
+            # It's either jamroot or standalone project. If it's jamroot,
             # inherit from user-config.
             if $(location)
             {
@@ -489,7 +489,7 @@
 {
     local attributes = $($(project-module).attributes) ;
     local pattributes = [ attributes $(parent-module) ] ;
-    # Parent module might be locationless user-config.
+    # Parent module might be locationless configuration module.
     if [ modules.binding $(parent-module) ]
     {
         $(attributes).set parent : [ path.parent
@@ -718,8 +718,8 @@
 
     if ! $(declared-id) || $(declared-id) != $(id)
     {
-        # The project at 'location' either have no id or
-        # that id is not equal to the 'id' parameter.
+        # The project at 'location' either has no id or that id is not equal to
+        # the 'id' parameter.
         if $($(id).jamfile-module)
             && $($(id).jamfile-module) != $(project-module)
         {
Modified: trunk/tools/build/v2/build/targets.jam
==============================================================================
--- trunk/tools/build/v2/build/targets.jam	(original)
+++ trunk/tools/build/v2/build/targets.jam	2008-01-05 15:37:44 EST (Sat, 05 Jan 2008)
@@ -127,14 +127,14 @@
         return $(location)/$(self.name) ;
     }
 
-    # Takes a property set.  Generates virtual targets for this abstract target,
-    # using the specified properties, unless a different value of some feature
-    # is required by the target.
+    # Generates virtual targets for this abstract target using the specified
+    # properties, unless a different value of some feature is required by the
+    # target.
     # On success, returns:
-    # - a property-set with the usage requirements to be applied to dependents
+    # - a property-set with the usage requirements to be applied to dependants
     # - a list of produced virtual targets, which may be empty.
-    # If 'property-set' are empty, performs default build of this target, in a
-    # way specific to derived class.
+    # If 'property-set' is empty, performs the default build of this target, in
+    # a way specific to the derived class.
     rule generate ( property-set )
     {
         errors.error "method should be defined in derived classes" ;
Modified: trunk/tools/build/v2/build/type.jam
==============================================================================
--- trunk/tools/build/v2/build/type.jam	(original)
+++ trunk/tools/build/v2/build/type.jam	2008-01-05 15:37:44 EST (Sat, 05 Jan 2008)
@@ -330,7 +330,7 @@
     if ! $(v)
     {
         v = [ generated-target-ps-real $(ps) : $(type)
-          : [ $(property-set).raw ] ] ;
+            : [ $(property-set).raw ] ] ;
         if ! $(v)
         {
             v = none ;
Modified: trunk/tools/build/v2/build/version.jam
==============================================================================
--- trunk/tools/build/v2/build/version.jam	(original)
+++ trunk/tools/build/v2/build/version.jam	2008-01-05 15:37:44 EST (Sat, 05 Jan 2008)
@@ -1,11 +1,13 @@
-# Copyright 2002, 2003, 2004, 2006 Vladimir Prus 
-# Distributed under the Boost Software License, Version 1.0. 
-# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 
+# Copyright 2002, 2003, 2004, 2006 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 
 rule boost-build ( )
 {
     return "V2 (Milestone 12)" ;
 }
+
+
 rule jam ( )
 {
     local v = [ modules.peek : JAM_VERSION  ] ;
Modified: trunk/tools/build/v2/build/virtual-target.jam
==============================================================================
--- trunk/tools/build/v2/build/virtual-target.jam	(original)
+++ trunk/tools/build/v2/build/virtual-target.jam	2008-01-05 15:37:44 EST (Sat, 05 Jan 2008)
@@ -5,19 +5,17 @@
 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 
 #  Implements virtual targets, which correspond to actual files created during
-#  build, but are not yet targets in Jam sense. They are needed, for example,
-#  when searching for possible transormation sequences, when it's not known
-#  if particular target should be created at all.
+#  a build, but are not yet targets in Jam sense. They are needed, for example,
+#  when searching for possible transormation sequences, when it's not yet known
+#  whether a particular target should be created at all.
 
 import "class" : new ;
+import errors ;
 import path ;
-import property-set ;
-import utility ;
 import sequence ;
-import errors ;
 import set ;
 import type ;
-import os ;
+import utility ;
 
 #                       +--------------------------+
 #                       | virtual-target           |
@@ -63,13 +61,12 @@
 #    +---------------------+     | actualize-sources() |
 #                                +---------------------+
 #
-# The 'compile-action' and 'link-action' classes are defined not here,
-# but in builtin.jam modules. They are shown in the diagram to give
-# the big picture.
-
-# Potential target. It can be converted into jam target and used in
-# building, if needed. However, it can be also dropped, which allows
-# to search for different transformation and select only one.
+# The 'compile-action' and 'link-action' classes are not defined here but in
+# builtin.jam modules. They are shown in the diagram to give the big picture.
+
+# Models a potential target. It can be converted into a Jam target and used in
+# building, if needed. However, it can be also dropped, which allows us to
+# search for different transformations and select only one.
 #
 class virtual-target
 {
@@ -78,8 +75,9 @@
     import utility ;
     import virtual-target ;
 
-    rule __init__ ( name  # Name of this target -- specifies the name of
-        : project # Project to which this target belongs
+    rule __init__ (
+          name     # Target/project name.
+        : project  # Project to which this target belongs.
     )
     {
         self.name = $(name) ;
@@ -93,12 +91,11 @@
     # Project of this target.
     rule project ( ) { return $(self.project) ; }
 
-    # Adds additional instances of 'virtual-target' that this
-    # one depends on.
+    # Adds additional 'virtual-target' instances this one depends on.
     rule depends ( d + )
     {
         self.dependencies = [ sequence.merge $(self.dependencies)
-                               : [ sequence.insertion-sort $(d) ] ] ;
+            : [ sequence.insertion-sort $(d) ] ] ;
     }
 
     rule dependencies ( )
@@ -106,16 +103,16 @@
         return $(self.dependencies) ;
     }
 
-    # Generates all the actual targets and sets up build actions for
-    # this target.
+    # Generates all the actual targets and sets up build actions for this
+    # target.
     #
-    # If 'scanner' is specified, creates an additional target
-    # with the same location as actual target, which will depend on the
-    # actual target and be associated with 'scanner'. That additional
-    # target is returned. See the docs (#dependency_scanning) for rationale.
-    # Target must correspond to a file if 'scanner' is specified.
+    # If 'scanner' is specified, creates an additional target with the same
+    # location as the actual target, which will depend on the actual target and
+    # be associated with a 'scanner'. That additional target is returned. See
+    # the docs (#dependency_scanning) for rationale. Target must correspond to a
+    # file if 'scanner' is specified.
     #
-    # If scanner is not specified, then actual target is returned.
+    # If scanner is not specified then the actual target is returned.
     rule actualize ( scanner ? )
     {
         local actual-name = [ actualize-no-scanner ] ;
@@ -131,7 +128,8 @@
                 [ utility.ungrist $(actual-name:G) ] $(scanner) : - ] ;
             local name = $(actual-name:G=$(g)) ;
 
-            if ! $(self.made.$(name)) {
+            if ! $(self.made.$(name))
+            {
                 self.made.$(name) = true ;
 
                 DEPENDS $(name) : $(actual-name) ;
@@ -142,13 +140,12 @@
             }
             return $(name) ;
         }
-
     }
 
 # private: (overridables)
 
-    # Sets up build actions for 'target'. Should call appropriate rules
-    # and set target variables.
+    # Sets up build actions for 'target'. Should call appropriate rules and set
+    # target variables.
     rule actualize-action ( target )
     {
         errors.error "method should be defined in derived classes" ;
@@ -160,15 +157,15 @@
         errors.error "method should be defined in derived classes" ;
     }
 
-    # If the target is generated one, returns the path where it will be
-    # generated. Otherwise, returns empty list.
+    # If the target is a generated one, returns the path where it will be
+    # generated. Otherwise, returns an empty list.
     rule path ( )
     {
         errors.error "method should be defined in derived classes" ;
     }
 
-    # Return that actual target name that should be used
-    # (for the case where no scanner is involved)
+    # Returns the actual target name to be used in case when no scanner is
+    # involved.
     rule actual-name ( )
     {
         errors.error "method should be defined in derived classes" ;
@@ -178,23 +175,21 @@
     rule actualize-no-scanner ( )
     {
         # In fact, we just need to merge virtual-target with
-        # abstract-virtual-target and the latter is the only class
-        # derived from the former. But that's for later.
+        # abstract-virtual-target as the latter is the only class derived from
+        # the former. But that's for later.
         errors.error "method should be defined in derived classes" ;
     }
 }
 
 
-# Target which correspond to a file. The exact mapping for file
-# is not yet specified in this class. (TODO: Actually, the class name
-# could be better...)
+# Target corresponding to a file. The exact mapping for file is not yet
+# specified in this class. (TODO: Actually, the class name could be better...)
 #
-# May be a source file (when no action is specified), or
-# derived file (otherwise).
+# May be a source file (when no action is specified) or a derived file
+# (otherwise).
 #
-# The target's grist is concatenation of project's location,
-# properties of action (for derived files), and, optionally,
-# value identifying the main target.
+# The target's grist is concatenation of its project's location, properties of
+# action (for derived files) and, optionally, value identifying the main target.
 class abstract-file-target : virtual-target
 {
     import project ;
@@ -206,12 +201,12 @@
     import indirect ;
 
     rule __init__ (
-         name     # Name for this target
-        exact ?   # If non-empty, the name is exactly the name
-                  # created file should have. Otherwise, the '__init__'
-                  # method will add suffix obtained from 'type' by
-                  # calling 'type.generated-target-suffix'.
-        : type ?  # The type of this target.
+         name     # Target's name.
+         exact ?  # If non-empty, the name is exactly the name created file
+                  # should have. Otherwise, the '__init__' method will add a
+                  # suffix obtained from 'type' by calling
+                  # 'type.generated-target-suffix'.
+        : type ?  # Target's type.
         : project
         : action ?
     )
@@ -240,15 +235,14 @@
         self.path = [ path.native $(path) ] ;
     }
 
-    # If 'a' is supplied, sets action to 'a'.
-    # Returns the action currently set.
+    # Returns the currently set action.
     rule action ( )
     {
         return $(self.action) ;
     }
 
-    # Sets/gets the 'root' flag. Target is root if it directly correspods to some
-    # variant of a main target.
+    # Sets/gets the 'root' flag. Target is root if it directly corresponds to
+    # some variant of a main target.
     rule root ( set ? )
     {
         if $(set)
@@ -258,25 +252,18 @@
         return $(self.root) ;
     }
 
-    # Gets or sets the subvariant which created this target. Subvariant
-    # is set when target is brought into existance, and is never changed
-    # after that. In particual, if target is shared by subvariant, only
-    # the first is stored.
-    rule creating-subvariant ( s ? # If specified, specified the value to set,
-                                   # which should be instance of 'subvariant'
-                                   # class.
+    # Gets or sets the subvariant which created this target. Subvariant is set
+    # when target is brought into existance and is never changed after that. In
+    # particular, if a target is shared by a subvariant, only the first is
+    # stored.
+    rule creating-subvariant ( s ? # If specified, specifies the value to set,
+                                   # which should be a 'subvariant' class
+                                   # instance.
                              )
     {
-        if $(s) && ( ! $(self.creating-subvariant) && ! $(overwrite) )
+        if $(s) && ! $(self.creating-subvariant) && ! $(overwrite)
         {
-            if $(self.creating-subvariant)
-            {
-                errors.error "Attempt to change 'dg'" ;
-            }
-            else
-            {
-                self.creating-subvariant = $(s) ;
-            }
+            self.creating-subvariant = $(s) ;
         }
         return $(self.creating-subvariant) ;
     }
@@ -289,9 +276,8 @@
         }
     }
 
-    # Return a human-readable representation of this target
-    #
-    # If this target has an action, that's:
+    # Return a human-readable representation of this target. If this target has
+    # an action, that's:
     #
     #    { <action-name>-<self.name>.<self.type> <action-sources>... }
     #
@@ -302,14 +288,12 @@
     rule str ( )
     {
         local action = [ action ] ;
-
-        local name-dot-type = [ sequence.join $(self.name) "."  $(self.type) ] ;
+        local name-dot-type = [ sequence.join $(self.name) "." $(self.type) ] ;
 
         if $(action)
         {
-            local sources = [ $(action).sources ] ;
-
-            local action-name =  [ $(action).action-name ] ;
+            local sources     = [ $(action).sources     ] ;
+            local action-name = [ $(action).action-name ] ;
 
             local ss ;
             for local s in $(sources)
@@ -347,7 +331,6 @@
         if ! $(self.actual-name)
         {
             local grist = [ grist ] ;
-
             local basename = [ path.native $(self.name) ] ;
             self.actual-name = <$(grist)>$(basename) ;
 
@@ -355,9 +338,9 @@
         return $(self.actual-name) ;
     }
 
-    # Helper to 'actual-name', above. Compute unique prefix used to distinguish
-    # this target from other targets with the same name which create different
-    # file.
+    # Helper to 'actual-name', above. Computes a unique prefix used to
+    # distinguish this target from other targets with the same name creating
+    # different files.
     rule grist ( )
     {
         # Depending on target, there may be different approaches to generating
@@ -372,18 +355,18 @@
         }
         else
         {
-            # File is either source, which will be searched for, or is not a file at
-            # all. Use the location of project for distinguishing.
+            # File is either source, which will be searched for, or is not a
+            # file at all. Use the location of project for distinguishing.
             local project-location = [ $(self.project).get location ] ;
-            local location-grist =
-              [ sequence.join [ regex.split $(project-location) "/" ] : "!" ] ;
+            local location-grist = [ sequence.join [ regex.split
+                $(project-location) "/" ] : "!" ] ;
 
             if $(self.action)
             {
                 local ps = [ $(self.action).properties ] ;
                 local property-grist = [ $(ps).as-path ] ;
-                # 'property-grist' can be empty when 'ps' is an empty
-                # property set.
+                # 'property-grist' can be empty when 'ps' is an empty property
+                # set.
                 if $(property-grist)
                 {
                     location-grist = $(location-grist)/$(property-grist) ;
@@ -394,17 +377,13 @@
         }
     }
 
-    # Given the target name specified in constructor, returns the
-    # name which should be really used, by looking at the <tag> properties.
-    # The tag properties come in two flavour:
-    #   - <tag>value,
-    #   - <tag>@rule-name
-    # In the first case, value is just added to name
-    # In the second case, the specified rule is called with specified name,
-    # target type and properties and should return the new name.
-    # If not <tag> property is specified, or the rule specified by
-    # <tag> returns nothing, returns the result of calling
-    # virtual-target.add-suffix
+    # Given the target name specified in constructor, returns the name which
+    # should be really used, by looking at the <tag> properties. Tag properties
+    # need to be specified as <tag>@rule-name. This makes Boost.Build call the
+    # specified rule with the target name, type and properties to get the new
+    # name. If no <tag> property is specified or the rule specified by <tag>
+    # returns nothing, returns the result of calling
+    # virtual-target.add-prefix-and-suffix.
     rule _adjust-name ( specified-name )
     {
         local ps ;
@@ -417,12 +396,11 @@
             ps = [ property-set.empty ] ;
         }
 
-        #~ We add ourselves to the properties so that any tag rule can get
-        #~ more direct information about the target than just that available
-        #~ through the properties. This is useful in implementing
-        #~ name changes based on the sources of the target. For example to
-        #~ make unique names of object files based on the source file.
-        #~ --grafik
+        # We add ourselves to the properties so that any tag rule can get more
+        # direct information about the target than just that available through
+        # the properties. This is useful in implementing name changes based on
+        # the sources of the target. For example to make unique names of object
+        # files based on the source file.  --grafik
         ps = [ property-set.create [ $(ps).raw ] <target>$(__name__) ] ;
 
         local tag = [ $(ps).get <tag> ] ;
@@ -434,24 +412,25 @@
             {
                 if $(tag[2])
                 {
-                    errors.error "<tag>@rulename is present but is not the only <tag> feature" ;
+                    errors.error "<tag>@rulename is present but is not the only"
+                        "<tag> feature" ;
                 }
 
-                self.name = [ indirect.call $(rule-name) $(specified-name) :
-                  $(self.type) :  $(ps) ] ;
+                self.name = [ indirect.call $(rule-name) $(specified-name)
+                    : $(self.type) : $(ps) ] ;
             }
             else
             {
                 errors.error
-                  "The value of the <tag> feature must be '@rule-nane'" ;
+                    "The value of the <tag> feature must be '@rule-name'" ;
             }
         }
 
         # If there's no tag or the tag rule returned nothing.
         if ! $(tag) || ! $(self.name)
         {
-            self.name = [ virtual-target.add-prefix-and-suffix
-                $(specified-name) : $(self.type) : $(ps) ] ;
+            self.name = [ virtual-target.add-prefix-and-suffix $(specified-name)
+                : $(self.type) : $(ps) ] ;
         }
     }
 
@@ -459,21 +438,23 @@
     {
         local name = [ actual-name ] ;
 
-        # Do anything only on the first invocation
-        if ! $(self.made.$(name)) {
+        # Do anything only on the first invocation.
+        if ! $(self.made.$(name))
+        {
             self.made.$(name) = true ;
 
             if $(self.action)
             {
-                # For non-derived target, we don't care if there
-                # are several virtual targets that refer to the same name.
-                # One case when this is unavoidable is when file name is
-                # main.cpp and two targets have types CPP (for compiling)
-                # and MOCCABLE_CPP (for convertion to H via Qt tools).
+                # For non-derived target, we don't care if there are several
+                # virtual targets that refer to the same name. One case when
+                # this is unavoidable is when the file name is main.cpp and two
+                # targets have types CPP (for compiling) and MOCCABLE_CPP (for
+                # conversion to H via Qt tools).
                 virtual-target.register-actual-name $(name) : $(__name__) ;
             }
 
-            for local i in $(self.dependencies) {
+            for local i in $(self.dependencies)
+            {
                 DEPENDS $(name) : [ $(i).actualize ] ;
             }
 
@@ -482,19 +463,18 @@
         }
         return $(name) ;
     }
-
 }
 
 
-# Appends the suffix appropriate to 'type/property-set' combination
-# to the specified name and returns the result.
+# Appends the suffix appropriate to 'type/property-set' combination to the
+# specified name and returns the result.
 rule add-prefix-and-suffix ( specified-name : type ? : property-set )
 {
     local suffix = [ type.generated-target-suffix $(type) : $(property-set) ] ;
 
-    # Handle suffixes for which no leading dot is desired.  Those are
-    # specified by enclosing them in <...>.  Needed by python so it
-    # can create "_d.so" extensions, for example.
+    # Handle suffixes for which no leading dot is desired. Those are specified
+    # by enclosing them in <...>.  Needed by python so it can create "_d.so"
+    # extensions, for example.
     if $(suffix:G)
     {
         suffix = [ utility.ungrist $(suffix) ] ;
@@ -514,25 +494,25 @@
 }
 
 
-# File target with explicitly known location.
+# File targets with explicitly known location.
 #
 # The file path is determined as
-#    - value passed to the 'set-path' method, if any
-#    - for derived files, project's build dir, joined with components
-#      that describe action's properties. If the free properties
-#      are not equal to the project's reference properties
-#      an element with name of main target is added.
-#    - for source files, project's source dir
+#    * Value passed to the 'set-path' method, if any.
+#    * For derived files, project's build dir, joined with components that
+#      describe action properties. If free properties are not equal to the
+#      project's reference properties an element with the name of the main
+#      target is added.
+#    * For source files, project's source dir.
 #
-# The file suffix is
-#     - the value passed to the 'suffix' method, if any, or
-#     - the suffix which correspond to the target's type.
+# The file suffix is determined as:
+#     * The value passed to the 'suffix' method, if any.
+#     * The suffix corresponding to the target's type.
 #
 class file-target : abstract-file-target
 {
+    import "class" : new ;
     import common ;
     import errors ;
-    import "class" : new ;
 
     rule __init__ (
       name exact ?
@@ -551,7 +531,7 @@
     rule clone-with-different-type ( new-type )
     {
         return [ new file-target $(self.name) exact : $(new-type)
-          : $(self.project) : $(self.action) : $(self.path) ] ;
+            : $(self.project) : $(self.action) : $(self.path) ] ;
     }
 
     rule actualize-location ( target )
@@ -566,35 +546,31 @@
             DEPENDS $(target) : $(path) ;
             common.MkDir $(path) ;
 
-            # It's possible that the target name includes a directory
-            # too, for example when installing headers. Create that
-            # directory.
+            # It's possible that the target name includes a directory too, for
+            # example when installing headers. Create that directory.
             if $(target:D)
             {
                 local d = $(target:D) ;
                 d = $(d:R=$(path)) ;
                 DEPENDS $(target) : $(d) ;
-
                 common.MkDir $(d) ;
             }
 
-            # For real file target, we create a fake target that
-            # depends on the real target. This allows to run
+            # For a real file target, we create a fake target depending on the
+            # real target. This allows us to run
             #
             #    bjam hello.o
             #
-            # without trying to guess the name of the real target.
-            # Note the that target has no directory name, and a special
-            # grist <e>.
+            # without trying to guess the name of the real target. Note that the
+            # target has no directory name and uses a special <e> grist.
             #
-            # First, that means that "bjam hello.o" will build all
-            # known hello.o targets.
-            # Second, the <e> grist makes sure this target won't be confused
-            # with other targets, for example, if we have subdir 'test'
-            # with target 'test' in it that includes 'test.o' file,
-            # then the target for directory will be just 'test' the target
-            # for test.o will be <ptest/bin/gcc/debug>test.o and the target
-            # we create below will be <e>test.o
+            # First, that means that "bjam hello.o" will build all known hello.o
+            # targets. Second, the <e> grist makes sure this target won't be
+            # confused with other targets, for example, if we have subdir 'test'
+            # with target 'test' in it that includes a 'test.o' file, then the
+            # target for directory will be just 'test' the target for test.o
+            # will be <ptest/bin/gcc/debug>test.o and the target we create below
+            # will be <e>test.o
             DEPENDS $(target:G=e) : $(target) ;
         }
         else
@@ -603,7 +579,7 @@
         }
     }
 
-    # Returns the directory for this target
+    # Returns the directory for this target.
     rule path ( )
     {
         if ! $(self.path)
@@ -615,20 +591,16 @@
 
                 if $(path[2]) = true
                 {
-                    # Indicates that the path is relative to
-                    # build dir.
+                    # Indicates that the path is relative to the build dir.
                     path = [ path.join [ $(self.project).build-dir ]
-                       $(path[1]) ] ;
+                        $(path[1]) ] ;
                 }
 
-                # Store the computed path, so that it's not recomputed
-                # any more
                 self.path = [ path.native $(path) ] ;
             }
         }
         return $(self.path) ;
      }
-
 }
 
 
@@ -639,7 +611,7 @@
         abstract-file-target.__init__ $(name) : : $(project) : $(action) ;
     }
 
-    # Returns nothing, to indicate that target path is not known.
+    # Returns nothing to indicate that the target's path is not known.
     rule path ( )
     {
         return ;
@@ -653,22 +625,22 @@
 }
 
 
-# Class which represents an action.
-# Both 'targets' and 'sources' should list instances of 'virtual-target'.
-# Action name should name a rule with this prototype
+# Class representing an action. Both 'targets' and 'sources' should list
+# instances of 'virtual-target'. Action name should name a rule with this
+# prototype:
 #     rule action-name ( targets + : sources * : properties * )
-# Targets and sources are passed as actual jam targets. The rule may
-# not establish dependency relationship, but should do everything else.
+# Targets and sources are passed as actual Jam targets. The rule may not
+# establish additional dependency relationships.
+
 class action
 {
+    import "class" ;
+    import errors ;
     import type ;
     import toolset ;
     import property-set ;
     import indirect ;
-    import "class" ;
     import path ;
-    import assert ;
-    import errors ;
 
     rule __init__ ( sources * : action-name + : property-set ? )
     {
@@ -734,30 +706,29 @@
 
             DEPENDS $(actual-targets) : $(self.actual-sources) $(self.dependency-only-sources) ;
 
-            # Action name can include additional argument to rule, which should not
-            # be passed to 'set-target-variables'
+            # Action name can include additional argument to rule, which should
+            # not be passed to 'set-target-variables'
             toolset.set-target-variables
-              [ indirect.get-rule $(self.action-name[1]) ] $(actual-targets)
+                [ indirect.get-rule $(self.action-name[1]) ] $(actual-targets)
                 : $(properties) ;
 
             # Reflect ourselves in a variable for the target. This allows
             # looking up additional info for the action given the raw target.
-            # For example to debug or output action information from action rules.
+            # For example to debug or output action information from action
+            # rules.
             .action on $(actual-targets) = $(__name__) ;
 
-            indirect.call $(self.action-name)
-              $(actual-targets) : $(self.actual-sources) : [ $(properties).raw ]
-                ;
+            indirect.call $(self.action-name) $(actual-targets)
+                : $(self.actual-sources) : [ $(properties).raw ] ;
 
-            # Since we set up creating action here, we also set up
-            # action for cleaning up
+            # Since we set up the creating action here, we set up the action for
+            # cleaning up as well.
             common.Clean clean-all : $(actual-targets) ;
         }
     }
 
-    # Helper for 'actualize-sources'.
-    # For each passed source, actualizes it with the appropriate scanner.
-    # Returns the actualized virtual targets.
+    # Helper for 'actualize-sources'. For each passed source, actualizes it with
+    # the appropriate scanner. Returns the actualized virtual targets.
     rule actualize-source-type ( sources * : property-set )
     {
         local result = ;
@@ -766,43 +737,40 @@
             local scanner ;
             if [ $(i).type ]
             {
-                scanner =
-                  [ type.get-scanner [ $(i).type ] : $(property-set) ] ;
+                scanner = [ type.get-scanner [ $(i).type ] : $(property-set) ] ;
             }
             result += [ $(i).actualize $(scanner) ] ;
         }
-
         return $(result) ;
     }
 
-    # Creates actual jam targets for sources. Initialized two member
-    # variables:.
-    # 'self.actual-sources' -- sources which are passed to updating action
-    # 'self.dependency-only-sources' -- sources which are made dependencies, but
-    # are not used otherwise.
+    # Creates actual Jam targets for sources. Initializes the following member
+    # variables:
+    #   'self.actual-sources'          -- sources passed to the updating action.
+    #   'self.dependency-only-sources' -- sources marked as dependencies, but
+    #                                     are not used otherwise.
     #
-    # New values will be *appended* to the variables. They may be non-empty,
-    # if caller wants it.
+    # New values will be *appended* to the variables. They may be non-empty if
+    # caller wants it.
     rule actualize-sources ( sources * : property-set )
     {
         local dependencies = [ $(self.properties).get <dependency> ] ;
 
-        self.dependency-only-sources += [
-          actualize-source-type $(dependencies) : $(property-set) ] ;
-        self.actual-sources += [
-          actualize-source-type $(sources) : $(property-set) ] ;
-
-        # This is used to help bjam find dependencies in generated headers
-        # in other main targets.
-        # Say:
+        self.dependency-only-sources +=
+            [ actualize-source-type $(dependencies) : $(property-set) ] ;
+        self.actual-sources +=
+            [ actualize-source-type $(sources) : $(property-set) ] ;
+
+        # This is used to help bjam find dependencies in generated headers and
+        # other main targets, e.g. in:
         #
         #   make a.h : ....... ;
         #   exe hello : hello.cpp : <implicit-dependency>a.h ;
         #
-        # However, for bjam to find the dependency the generated target must
-        # be actualized (i.e. have the jam target). In the above case,
-        # if we're building just hello ("bjam hello"), 'a.h' won't be
-        # actualized unless we do it here.
+        # For bjam to find the dependency the generated target must be
+        # actualized (i.e. have its Jam target constructed). In the above case,
+        # if we're building just hello ("bjam hello"), 'a.h' won't be actualized
+        # unless we do it here.
         local implicit = [ $(self.properties).get <implicit-dependency> ] ;
         for local i in $(implicit)
         {
@@ -810,10 +778,10 @@
         }
     }
 
-    # Determined real properties when trying building with 'properties'.
-    # This is last chance to fix properties, for example to adjust includes
-    # to get generated headers correctly. Default implementation returns
-    # its argument.
+    # Determines real properties when trying to build with 'properties'. This is
+    # the last chance to fix properties, for example to adjust includes to get
+    # generated headers correctly. Default implementation simply returns its
+    # argument.
     rule adjust-properties ( property-set )
     {
         return $(property-set) ;
@@ -821,15 +789,15 @@
 }
 
 
-# Action class which does nothing --- it produces the targets with
-# specific properties out of nowhere. It's needed to distinguish virtual
-# targets with different properties that are known to exist, and have no
-# actions which create them.
+# Action class which does nothing --- it produces the targets with specific
+# properties out of nowhere. It's needed to distinguish virtual targets with
+# different properties that are known to exist and have no actions which create
+# them.
 class null-action : action
 {
     rule __init__ ( property-set ? )
     {
-        action.__init__  : .no-action : $(property-set) ;
+        action.__init__ : .no-action : $(property-set) ;
     }
 
     rule actualize ( )
@@ -837,7 +805,6 @@
         if ! $(self.actualized)
         {
             self.actualized = true ;
-
             for local i in [ targets ]
             {
                 $(i).actualize ;
@@ -847,14 +814,15 @@
 }
 
 
-# Class which acts exactly like 'action', except that the sources
-# are not scanned for dependencies.
+# Class which acts exactly like 'action', except that its sources are not
+# scanned for dependencies.
 class non-scanning-action : action
 {
     rule __init__ ( sources * : action-name + : property-set ? )
     {
         action.__init__ $(sources) : $(action-name) : $(property-set) ;
     }
+
     rule actualize-source-type ( sources * : property-set )
     {
         local result ;
@@ -867,20 +835,19 @@
 }
 
 
-# Creates a virtual target with appropriate name and type from 'file'. If a
-# target with that name in that project was already created, returns that
-# already created target.
-# FIXME: more correct way would be to compute path to the file, based on name
-# and source location for the project, and use that path to determine if the
-# target was already created.
-# TODO: passing project with all virtual targets starts to be annoying.
+# Creates a virtual target with an appropriate name and type from 'file'. If a
+# target with that name in that project already exists, returns that already
+# created target.
+# FIXME: a more correct way would be to compute the path to the file, based on
+# name and source location for the project, and use that path to determine if
+# the target was already created.
+# TODO: passing a project with all virtual targets is starting to be annoying.
 rule from-file ( file : file-loc : project )
 {
-    import type ;  # had to do this here to break a circular dependency
+    import type ;  # Had to do this here to break a circular dependency.
 
     # Check if we've created a target corresponding to this file.
-    local path = [ path.root [ path.root $(file) $(file-loc) ]
-                             [ path.pwd ] ] ;
+    local path = [ path.root [ path.root $(file) $(file-loc) ] [ path.pwd ] ] ;
 
     if $(.files.$(path))
     {
@@ -893,10 +860,10 @@
         local result ;
 
         result = [ new file-target $(file)
-                         : $(type)
-                         : $(project)
-                         : #action
-                         : $(file-loc) ] ;
+            : $(type)
+            : $(project)
+            : #action
+            : $(file-loc) ] ;
 
         .files.$(path) = $(result) ;
         return $(result) ;
@@ -904,14 +871,15 @@
 }
 
 
-# Registers a new virtual target. Checks if there's already registered target,
-# with the same name, type, project and subvariant properties, and also with the
-# same sources and equal action. If such target is found it is returned and
-# 'target' is not registered. Otherwise, 'target' is registered and returned.
+# Registers a new virtual target. Checks if there's already a registered target
+# with the same name, type, project and subvariant properties as well as the
+# same sources and equal action. If such target is found it is returned and a
+# new 'target' is not registered. Otherwise, 'target' is registered and
+# returned.
 rule register ( target )
 {
     local signature = [ sequence.join
-       [ $(target).path ] [ $(target).name ] : - ] ;
+        [ $(target).path ] [ $(target).name ] : - ] ;
 
     local result ;
     for local t in $(.cache.$(signature))
@@ -927,8 +895,9 @@
             }
             else
             {
-                if $(a1) && $(a2) && [ $(a1).action-name ] = [ $(a2).action-name ] &&
-                  [ $(a1).sources ] = [ $(a2).sources ]
+                if $(a1) && $(a2) &&
+                    [ $(a1).action-name ] = [ $(a2).action-name ] &&
+                    [ $(a1).sources     ] = [ $(a2).sources     ]
                 {
                     local ps1 = [ $(a1).properties ] ;
                     local ps2 = [ $(a2).properties ] ;
@@ -956,9 +925,9 @@
 }
 
 
-# Each target returned by 'register' is added to a list of 'recent-target',
-# returned by this function. So, this allows us to find all targets created when
-# building a given main target, even if the target... !!!MISSING TEXT HERE!!!
+# Each target returned by 'register' is added to a recent-targets list, returned
+# by this function. This allows us to find all targets created when building a
+# given main target, even if the target... !!!MISSING TEXT HERE!!!
 rule recent-targets ( )
 {
     return $(.recent-targets) ;
@@ -990,7 +959,6 @@
             result += $(t) ;
         }
     }
-
     return $(result) ;
 }
 
@@ -1020,12 +988,12 @@
             properties-added ?= "none" ;
         }
         errors.error "Duplicate name of actual target:" $(actual-name)
-          : "previous virtual target" [ $(.actual.$(actual-name)).str ]
-          : "created from" [ $(cmt1).full-name ]
-          : "another virtual target" [ $(virtual-target).str ]
-          : "created from" [ $(cmt2).full-name ]
-          : "added properties: " $(properties-added)
-          : "removed properties: " $(properties-removed) ;
+            : "previous virtual target" [ $(.actual.$(actual-name)).str ]
+            : "created from"            [ $(cmt1).full-name ]
+            : "another virtual target"  [ $(virtual-target).str ]
+            : "created from"            [ $(cmt2).full-name ]
+            : "added properties:"       $(properties-added)
+            : "removed properties:"     $(properties-removed) ;
     }
     else
     {
@@ -1035,16 +1003,17 @@
 
 
 # Traverses the dependency graph of 'target' and return all targets that will be
-# created before this one is created. If root of some dependency graph is found
-# during traversal, it's either included or not, dependencing of the value of
-# 'include-roots'. In either case, sources of root are not traversed.
+# created before this one is created. If the root of some dependency graph is
+# found during traversal, it's either included or not, depending on the value of
+# 'include-roots'. In either case traversal stops at root targets, i.e. sources
+# of root targets are not traversed.
 rule traverse ( target : include-roots ? : include-sources ? )
 {
     local result ;
     if [ $(target).action ]
     {
         local action = [ $(target).action ] ;
-        # This includes 'target' as well
+        # This includes the 'target' as well.
         result += [ $(action).targets ] ;
 
         for local t in [ $(action).sources ]
@@ -1090,9 +1059,9 @@
     for local target in [ $(action).targets ]
     {
         local n = [ $(target).name ] ;
-        # Don't modify the name of the produced targets.Strip the directory f
-        local cloned-target = [ class.new file-target $(n) exact : [ $(target).type ]
-          : $(new-project) : $(cloned-action) ] ;
+        # Don't modify produced targets names.
+        local cloned-target = [ class.new file-target $(n) exact
+            : [ $(target).type ] : $(new-project) : $(cloned-action) ] ;
         local d = [ $(target).dependencies ] ;
         if $(d)
         {
@@ -1113,12 +1082,12 @@
     import sequence ;
     import type ;
 
-    rule __init__ ( main-target # The instance of main-target class
-        : property-set                     # Properties requested for this target
+    rule __init__ ( main-target       # The instance of main-target class.
+        : property-set                # Properties requested for this target.
         : sources *
-        : build-properties                 # Actually used properties
-        : sources-usage-requirements       # Properties propagated from sources
-        : created-targets * )              # Top-level created targets
+        : build-properties            # Actually used properties.
+        : sources-usage-requirements  # Properties propagated from sources.
+        : created-targets * )         # Top-level created targets.
     {
         self.main-target = $(main-target) ;
         self.properties = $(property-set) ;
@@ -1127,8 +1096,7 @@
         self.sources-usage-requirements = $(sources-usage-requirements) ;
         self.created-targets = $(created-targets) ;
 
-        # Pre-compose the list of other dependency graphs, on which this one
-        # depends
+        # Pre-compose a list of other dependency graphs this one depends on.
         local deps = [ $(build-properties).get <implicit-dependency> ] ;
         for local d in $(deps)
         {
@@ -1200,12 +1168,11 @@
         return $(all-targets) ;
     }
 
-    # Returns the properties which specify implicit include paths to
-    # generated headers. This traverses all targets in this subvariant,
-    # and subvariants referred by <implcit-dependecy>properties.
-    # For all targets which are of type 'target-type' (or for all targets,
-    # if 'target-type' is not specified), the result will contain
-    # <$(feature)>path-to-that-target.
+    # Returns the properties specifying implicit include paths to generated
+    # headers. This traverses all targets in this subvariant and subvariants
+    # referred by <implcit-dependecy> properties. For all targets of type
+    # 'target-type' (or for all targets, if 'target-type' is not specified), the
+    # result will contain <$(feature)>path-to-that-target.
     rule implicit-includes ( feature : target-type ? )
     {
         local key = ii$(feature)-$(target-type:E="") ;
@@ -1244,11 +1211,9 @@
         local result ;
         for local t in $(self.created-targets)
         {
-            if $(target-type) && ! [ type.is-derived [ $(t).type ] $(target-type) ]
-            {
-                # Skip target which is of wrong type.
-            }
-            else
+            # Skip targets of the wrong type.
+            if ! $(target-type) ||
+                [ type.is-derived [ $(t).type ] $(target-type) ]
             {
                 result = [ sequence.merge $(result) : [ $(t).path ] ] ;
             }
Modified: trunk/tools/build/v2/kernel/errors.jam
==============================================================================
--- trunk/tools/build/v2/kernel/errors.jam	(original)
+++ trunk/tools/build/v2/kernel/errors.jam	2008-01-05 15:37:44 EST (Sat, 05 Jan 2008)
@@ -1,50 +1,48 @@
-# Copyright 2003 Dave Abrahams 
-# Copyright 2004 Vladimir Prus 
-# Distributed under the Boost Software License, Version 1.0. 
-# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 
-
-# Print a stack backtrace leading to this rule's caller. Each
-# argument represents a line of output to be printed after the first
-# line of the backtrace.
+# Copyright 2003 Dave Abrahams
+# Copyright 2004 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+
+# Print a stack backtrace leading to this rule's caller. Each argument
+# represents a line of output to be printed after the first line of the
+# backtrace.
 rule backtrace ( skip-frames prefix messages * : * )
 {
     local frame-skips = 5 9 13 17 21 25 29 33 37 41 45 49 53 57 61 65 69 73 77 81 ;
     local drop-elements = $(frame-skips[$(skip-frames)]) ;
     if ! ( $(skip-frames) in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 )
     {
-        ECHO warning: backtrace doesn't support skipping
-          $(skip-frames) frames; using 1 instead. ;
+        ECHO warning: backtrace doesn't support skipping $(skip-frames) frames;
+            using 1 instead. ;
         drop-elements = 5 ;
     }
-    
-    local args = $(.args) ;    
+
+    local args = $(.args) ;
     if $(.user-modules-only)
     {
         local bt = [ nearest-user-location ] ;
         ECHO "$(prefix) at $(bt) " ;
         for local n in $(args)
-        {            
+        {
             if $($(n))-is-not-empty
             {
                 ECHO $(prefix) $($(n)) ;
             }
-        }        
+        }
     }
     else
     {
-        # get the whole backtrace, then drop the initial quadruples
+        # Get the whole backtrace, then drop the initial quadruples
         # corresponding to the frames that must be skipped.
         local bt = [ BACKTRACE ] ;
-        bt = $(bt[$(drop-elements)-]) ; 
-        
+        bt = $(bt[$(drop-elements)-]) ;
+
         while $(bt)
         {
             local m = [ MATCH ^(.+)\\.$ : $(bt[3]) ] ;
             ECHO $(bt[1]):$(bt[2]): "in" $(bt[4]) "from module" $(m) ;
-       
-                        
-            # the first time through, print each argument on a separate
-            # line
+
+            # The first time through, print each argument on a separate line.
             for local n in $(args)
             {
                 if $($(n))-is-not-empty
@@ -52,39 +50,40 @@
                     ECHO $(prefix) $($(n)) ;
                 }
             }
-            args = ; # kill args so that this never happens again
-            
-            # Move on to the next quadruple
+            args = ;  # Kill args so that this never happens again.
+
+            # Move on to the next quadruple.
             bt = $(bt[5-]) ;
         }
-    }    
+    }
 }
 
 .args ?= messages 2 3 4 5 6 7 8 9 ;
 .disabled ?= ;
-.last-error-$(.args) ?= ; 
+.last-error-$(.args) ?= ;
+
 
 # try-catch --
 #
-# This is not really an exception-handling mechanism, but it does
-# allow us to perform some error-checking on our
-# error-checking. Errors are suppressed after a try, and the first one
-# is recorded. Use catch to check that the error message matched
-# expectations.
+# This is not really an exception-handling mechanism, but it does allow us to
+# perform some error-checking on our error-checking. Errors are suppressed after
+# a try, and the first one is recorded. Use catch to check that the error
+# message matched expectations.
 
-# begin looking for error messages
+# Begin looking for error messages.
 rule try ( )
 {
     .disabled += true ;
     .last-error-$(.args) = ;
 }
 
-# stop looking for error messages; generate an error if an argument of
-# messages is not found in the corresponding argument in the error call.
+
+# Stop looking for error messages; generate an error if an argument of messages
+# is not found in the corresponding argument in the error call.
 rule catch ( messages * : * )
 {
-    .disabled = $(.disabled[2-]) ; # pop the stack    
-    
+    .disabled = $(.disabled[2-]) ;  # Pop the stack.
+
     import sequence ;
 
     if ! $(.last-error-$(.args))-is-nonempty
@@ -109,6 +108,7 @@
     }
 }
 
+
 rule error-skip-frames ( skip-frames messages * : * )
 {
     if ! $(.disabled)
@@ -122,12 +122,12 @@
         {
             # Add an extra empty string so that we always have
             # something in the event of an error
-            .last-error-$(n) = $($(n)) "" ; 
+            .last-error-$(n) = $($(n)) "" ;
         }
     }
 }
 
-if --no-error-backtrace in [ modules.peek : ARGV ] 
+if --no-error-backtrace in [ modules.peek : ARGV ]
 {
     .no-error-backtrace = true ;
 }
@@ -144,24 +144,25 @@
             if $($(n))-is-not-empty
             {
                 if ! $(first-printed)
-                {                    
+                {
                     ECHO error: $($(n)) ;
                     first-printed = true ;
                 }
                 else
                 {
-                    ECHO $($(n)) ;                    
-                }                                
+                    ECHO $($(n)) ;
+                }
             }
-        }        
+        }
         EXIT ;
     }
     else
-    {        
+    {
         error-skip-frames 3 $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
-    }    
+    }
 }
 
+
 # Same as 'error', but the generated backtrace will include only user files.
 rule user-error ( messages * : * )
 {
@@ -176,10 +177,11 @@
     backtrace 2 warning: $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
 }
 
-# convert an arbitrary argument list into a list with ":" separators
-# and quoted elements representing the same information. This is
-# mostly useful for formatting descriptions of the arguments with
-# which a rule was called when reporting an error.
+
+# Convert an arbitrary argument list into a list with ":" separators and quoted
+# elements representing the same information. This is mostly useful for
+# formatting descriptions of arguments with which a rule was called when
+# reporting an error.
 rule lol->list ( * )
 {
     local result ;
@@ -188,7 +190,7 @@
     {
         local n = $(remaining[1]) ;
         remaining = $(remaining[2-]) ;
-        
+
         if $(n) != 1
         {
             result += ":" ;
@@ -198,49 +200,50 @@
     return $(result) ;
 }
 
-# Return the file:line for the nearest entry in backtrace which correspond
-# to a user module.
+
+# Return the file:line for the nearest entry in backtrace which correspond to a
+# user module.
 rule nearest-user-location ( )
 {
     local bt = [ BACKTRACE ] ;
-    
+
     local result ;
     while $(bt) && ! $(result)
     {
         local m = [ MATCH ^(.+)\\.$ : $(bt[3]) ] ;
         local user-modules = ([Jj]amroot(.jam|.v2|)|([Jj]amfile(.jam|.v2|)|user-config.jam|site-config.jam|project-root.jam) ;
-        
-        if [ MATCH $(user-modules) : $(bt[1]:D=) ] 
-        {                
+
+        if [ MATCH $(user-modules) : $(bt[1]:D=) ]
+        {
             result = $(bt[1]):$(bt[2]) ;
-        }            
+        }
         bt = $(bt[5-]) ;
     }
     return $(result) ;
 }
 
-# If optimized rule is available in jam, use it.
-if NEAREST_USER_LOCATION in [ RULENAMES ] 
+# If optimized rule is available in Jam, use it.
+if NEAREST_USER_LOCATION in [ RULENAMES ]
 {
     rule nearest-user-location ( )
     {
         local r = [ NEAREST_USER_LOCATION ] ;
         return $(r[1]):$(r[2]) ;
-    }    
+    }
 }
 
 
 
 rule __test__ ( )
 {
-    # show that we can correctly catch an expected error
+    # Show that we can correctly catch an expected error.
     try ;
     {
         error an error occurred : somewhere ;
     }
     catch an error occurred : somewhere ;
-    
-    # show that unexpected errors generate real errors
+
+    # Show that unexpected errors generate real errors.
     try ;
     {
         try ;
@@ -250,9 +253,8 @@
         catch an error occurred : nowhere ;
     }
     catch expected \"nowhere\" in argument 2 ;
-    
-    # show that not catching an error where one was expected is an
-    # error
+
+    # Show that not catching an error where one was expected is an error.
     try ;
     {
         try ;
Modified: trunk/tools/build/v2/kernel/modules.jam
==============================================================================
--- trunk/tools/build/v2/kernel/modules.jam	(original)
+++ trunk/tools/build/v2/kernel/modules.jam	2008-01-05 15:37:44 EST (Sat, 05 Jan 2008)
@@ -3,20 +3,22 @@
 # Distributed under the Boost Software License, Version 1.0.
 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 
-# Essentially an include guard; ensures that no module is loaded multiple times
+# Essentially an include guard; ensures that no module is loaded multiple times.
 .loaded ?= ;
 
-# A list of modules currently being loaded for error reporting of circular dependencies
+# A list of modules currently being loaded for error reporting of circular
+# dependencies.
 .loading ?= ;
 
-# A list of modules needing to be tested via __test__ rule
+# A list of modules needing to be tested via __test__ rule.
 .untested ?= ;
 
-# A list of modules which have been tested via __test__
+# A list of modules which have been tested via __test__.
 .tested ?= ;
 
-# meant to be invoked from import when no __test__ rule is defined in a given
-# module
+
+# Meant to be invoked from import when no __test__ rule is defined in the given
+# module.
 local rule no-test-defined
 {
     import modules ;
@@ -26,15 +28,17 @@
     }
 }
 
-# return the binding of the given module
+
+# Return the binding of the given module.
 rule binding ( module )
 {
     return $($(module).__binding__) ;
 }
 
-# Sets the module-local value of a variable.  This is the most
-# reliable way to set a module-local variable in a different module;
-# it eliminates issues of name shadowing due to dynamic scoping.
+
+# Sets the module-local value of a variable. This is the most reliable way to
+# set a module-local variable in a different module; it eliminates issues of
+# name shadowing due to dynamic scoping.
 rule poke ( module-name ? : variables + : value * )
 {
     module $(<)
@@ -43,10 +47,10 @@
     }
 }
 
-# Returns the module-local value of a variable.  This is the most
-# reliable way to examine a module-local variable in a different
-# module; it eliminates issues of name shadowing due to dynamic
-# scoping.
+
+# Returns the module-local value of a variable. This is the most reliable way to
+# examine a module-local variable in a different module; it eliminates issues of
+# name shadowing due to dynamic scoping.
 rule peek ( module-name ? : variables + )
 {
     module $(<)
@@ -55,10 +59,11 @@
     }
 }
 
-# Call the given rule locally in the given module. Use this for rules
-# which accept rule names as arguments, so that the passed rule may be
-# invoked in the context of the rule's caller (for example, if the
-# rule accesses module globals or is a local rule).
+
+# Call the given rule locally in the given module. Use this for rules accepting
+# rule names as arguments, so that the passed rule may be invoked in the context
+# of the rule's caller (for example, if the rule accesses module globals or is a
+# local rule).
 rule call-in ( module-name ? : rule-name args * : * )
 {
     module $(module-name)
@@ -67,26 +72,27 @@
     }
 }
 
-# Given a possibly qualified rule name and arguments, remove any
-# initial module qualification from the rule and invoke it in that
-# module.  If there is no module qualification, the rule is invoked in
-# the global module.
+
+# Given a possibly qualified rule name and arguments, remove any initial module
+# qualification from the rule and invoke it in that module. If there is no
+# module qualification, the rule is invoked in the global module.
 rule call-locally ( qualified-rule-name args * : * )
 {
     local module-rule = [ MATCH (.*)\\.(.*) : $(qualified-rule-name) ] ;
     local rule-name = $(module-rule[2]) ;
     rule-name ?= $(qualified-rule-name) ;
-    return [
-      call-in $(module-rule[1])
-        : $(rule-name) $(args) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9)
-    ] ;
+    return [ call-in $(module-rule[1]) : $(rule-name) $(args)
+        : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ] ;
 }
 
-# load the indicated module if it is not already loaded.
+
+# Load the indicated module if it is not already loaded.
 rule load (
-  module-name      # name of module to load. Rules will be defined in this module
-    : filename ?   # (partial) path to file; Defaults to $(module-name).jam
-    : search *     # Directories in which to search for filename. Defaults to $(BOOST_BUILD_PATH)
+      module-name  # Name of module to load. Rules will be defined in this
+                   # module.
+    : filename ?   # (partial) path to file; Defaults to $(module-name).jam.
+    : search *     # Directories in which to search for filename. Defaults to
+                   # $(BOOST_BUILD_PATH).
 )
 {
     # Avoid loading modules twice
@@ -94,28 +100,28 @@
     {
         filename ?= $(module-name).jam ;
 
-        # Mark the module loaded so we don't try to load it recursively
+        # Mark the module loaded so we don't try to load it recursively.
         .loaded += $(module-name) ;
 
-        # suppress tests if any module loads are already in progress.
+        # Suppress tests if any module loads are already in progress.
         local suppress-test = $(.loading[1]) ;
 
-        # Push this module on the loading stack
+        # Push this module on the loading stack.
         .loading += $(module-name) ;
 
-        # Remember that it's untested
+        # Remember that it's untested.
         .untested += $(module-name) ;
 
-        # Insert the new module's __name__ and __file__ globals
+        # Insert the new module's __name__ and __file__ globals.
         poke $(module-name) : __name__ : $(module-name) ;
         poke $(module-name) : __file__ : $(filename) ;
 
         module $(module-name)
         {
-            # Prepare a default behavior, in case no __test__ is defined.
+            # Prepare default behavior, in case no __test__ is defined.
             IMPORT modules : no-test-defined : $(__name__) : __test__ ;
 
-            # Add some grist so that the module will have a unique target name
+            # Add some grist so that the module will have a unique target name.
             local module-target = $(__file__:G=module@) ;
 
             local search = $(3) ;
@@ -125,7 +131,7 @@
 
             include $(module-target) ;
 
-            # Allow the module to see its own names with full qualification
+            # Allow the module to see its own names with full qualification.
             local rules = [ RULENAMES $(__name__) ] ;
             IMPORT $(__name__) : $(rules) : $(__name__) : $(__name__).$(rules) ;
         }
@@ -133,20 +139,21 @@
         if $(module-name) != modules && ! [ binding $(module-name) ]
         {
             import errors ;
-            errors.error "couldn't find module" $(module-name) in $(search) ;
+            errors.error "Couldn't find module" $(module-name) in $(search) ;
         }
 
-        # Pop the loading stack. Must happen before testing or we'll find a circular loading dependency
+        # Pop the loading stack. Must happen before testing or we'll run into a
+        # circular loading dependency.
         .loading = $(.loading[1--2]) ;
 
-        # Run any pending tests if this is an outer load
+        # Run any pending tests if this is an outer load.
         if ! $(suppress-test)
         {
             local argv = [ peek : ARGV ] ;
             for local m in $(.untested)
             {
-                if ( ! $(m) in $(.tested) )    # avoid recursive test invocations
-                   && ( ( --debug in $(argv) ) || ( --debug-module=$(m) in $(argv) ) )
+                if ( ! $(m) in $(.tested) )  # Avoid recursive test invocations.
+                    && ( ( --debug in $(argv) ) || ( --debug-module=$(m) in $(argv) ) )
                 {
                     .tested += $(m) ;
                     if ! ( --quiet in $(argv) )
@@ -154,18 +161,18 @@
                         ECHO testing module $(m)... ;
                     }
 
-                    # Import m's rules into __test-$(m)__ for easy access
+                    # Import m's rules into __test-$(m)__ for easy access.
                     IMPORT $(m) : [ RULENAMES $(m) ] : __test-$(m)__ : [ RULENAMES $(m) ] ;
 
-                    # execute the module's __test__ rule in its own module to
-                    # eliminate the inadvertent effects of testing
-                    # module dependencies (such as assert) on the module itself.
+                    # Execute the module's __test__ rule in its own module to
+                    # eliminate the inadvertent effects of testing module
+                    # dependencies (such as assert) on the module itself.
                     IMPORT $(m) : __test__ : __test-$(m)__ : __test__ : LOCALIZE ;
 
                     module __test-$(m)__
                     {
-                        # set up the name of the module we're testing
-                        # so that no-test-defined can find it.
+                        # Set up the name of the module we're testing so that
+                        # no-test-defined can find it.
                         __module__ = $(1) ;
                         __test__ ;
                     }
@@ -178,23 +185,24 @@
     {
         import errors ;
         errors.error loading \"$(module-name)\"
-        : circular module loading dependency:
-        : $(.loading)" ->" $(module-name) ;
+            : circular module loading dependency:
+            : $(.loading)" ->" $(module-name) ;
     }
 }
 
-# This helper is used by load (above) to record the binding (path) of
-# each loaded module.
+
+# This helper is used by load (above) to record the binding (path) of each
+# loaded module.
 rule record-binding ( module-target : binding )
 {
     $(.loading[-1]).__binding__ = $(binding) ;
 }
 
-# Transform each path in the list, with all backslashes converted to
-# forward slashes and all detectable redundancy removed.  Something
-# like this is probably needed in path.jam, but I'm not sure of that,
-# I don't understand it, and I'm not ready to move all of path.jam
-# into the kernel.
+
+# Transform each path in the list, with all backslashes converted to forward
+# slashes and all detectable redundancy removed. Something like this is probably
+# needed in path.jam, but I'm not sure of that, I don't understand it, and I'm
+# not ready to move all of path.jam into the kernel.
 local rule normalize-raw-paths ( paths * )
 {
     local result ;
@@ -205,30 +213,28 @@
     return $(result) ;
 }
 
+
 .cwd = [ PWD ] ;
 
 
-# load the indicated module and import rule names into the current
-# module. Any members of rules-opt will be available without
-# qualification in the caller's module. Any members of rename-opt will
-# be taken as the names of the rules in the caller's module, in place
-# of the names they have in the imported module. If rules-opt = '*',
-# all rules from the indicated module are imported into the caller's
-# module. If rename-opt is supplied, it must have the same number of
+# Load the indicated module and import rule names into the current module. Any
+# members of rules-opt will be available without qualification in the caller's
+# module. Any members of rename-opt will be taken as the names of the rules in
+# the caller's module, in place of the names they have in the imported module.
+# If rules-opt = '*', all rules from the indicated module are imported into the
+# caller's module. If rename-opt is supplied, it must have the same number of
 # elements as rules-opt.
 rule import ( module-names + : rules-opt * : rename-opt * )
 {
-    if $(rules-opt) = * || ! $(rules-opt)
+    if ( $(rules-opt) = * || ! $(rules-opt) ) && $(rename-opt)
     {
-        if $(rename-opt)
-        {
-            errors.error "rule aliasing is only available for explicit imports." ;
-        }
+        errors.error "Rule aliasing is only available for explicit imports." ;
     }
 
     if $(module-names[2]) && ( $(rules-opt) || $(rename-opt) )
     {
-        errors.error when loading multiple modules, no specific rules or renaming is allowed ;
+        errors.error "When loading multiple modules, no specific rules or"
+            "renaming is allowed" ;
     }
 
     local caller = [ CALLER_MODULE ] ;
@@ -238,9 +244,9 @@
     {
         if ! $(m) in $(.loaded)
         {
-            # if the importing module isn't already in the BOOST_BUILD_PATH,
-            # prepend it to the path.  We don't want to invert the search
-            # order of modules that are already there.
+            # If the importing module isn't already in the BOOST_BUILD_PATH,
+            # prepend it to the path.  We don't want to invert the search order
+            # of modules that are already there.
 
             local caller-location ;
             if $(caller)
@@ -282,14 +288,11 @@
     }
 }
 
-# Define exported copies in $(target-module) of all rules exported
-# from $(source-module).  Also make them available in the global
-# module with qualification, so that it is just as though the rules
-# were defined originally in $(target-module).
-rule clone-rules (
-    source-module
-    target-module
-    )
+# Define exported copies in $(target-module) of all rules exported from
+# $(source-module). Also make them available in the global module with
+# qualification, so that it is just as though the rules were defined originally
+# in $(target-module).
+rule clone-rules ( source-module target-module )
 {
     local rules = [ RULENAMES $(source-module) ] ;
 
@@ -298,11 +301,13 @@
     IMPORT $(target-module) : $(rules) : : $(target-module).$(rules) ;
 }
 
-# These rules need to be available in all modules to implement
-# module loading itself and other fundamental operations.
+
+# These rules need to be available in all modules to implement module loading
+# itself and other fundamental operations.
 local globalize = peek poke record-binding ;
 IMPORT modules : $(globalize) : : modules.$(globalize) ;
 
+
 local rule __test__ ( )
 {
     import assert ;
@@ -314,18 +319,18 @@
     }
 
     assert.result bar : peek modules.__test__ : foo ;
+
     poke modules.__test__ : foo : bar baz ;
     assert.result bar baz : peek modules.__test__ : foo ;
+
     assert.result c:/foo/bar : normalize-raw-paths c:/x/../foo/./xx/yy/../../bar ;
-    assert.result . : normalize-raw-paths . ;
-    assert.result .. : normalize-raw-paths .. ;
-    assert.result ../.. : normalize-raw-paths ../.. ;
-    assert.result .. : normalize-raw-paths ./.. ;
-    assert.result / / : normalize-raw-paths / \\ ;
-    assert.result a : normalize-raw-paths a ;
-    assert.result a : normalize-raw-paths a/ ;
-    assert.result /a : normalize-raw-paths /a/ ;
-    assert.result / : normalize-raw-paths /a/.. ;
+    assert.result .          : normalize-raw-paths .                             ;
+    assert.result ..         : normalize-raw-paths ..                            ;
+    assert.result ../..      : normalize-raw-paths ../..                         ;
+    assert.result ..         : normalize-raw-paths ./..                          ;
+    assert.result / /        : normalize-raw-paths / \\                          ;
+    assert.result a          : normalize-raw-paths a                             ;
+    assert.result a          : normalize-raw-paths a/                            ;
+    assert.result /a         : normalize-raw-paths /a/                           ;
+    assert.result /          : normalize-raw-paths /a/..                         ;
 }
-
-
Modified: trunk/tools/build/v2/test/BoostBuild.py
==============================================================================
--- trunk/tools/build/v2/test/BoostBuild.py	(original)
+++ trunk/tools/build/v2/test/BoostBuild.py	2008-01-05 15:37:44 EST (Sat, 05 Jan 2008)
@@ -6,29 +6,28 @@
 #         http://www.boost.org/LICENSE_1_0.txt)
 
 import TestCmd
-from tree import build_tree, trees_difference
 import copy
 import fnmatch
 import glob
+import math
 import os
 import re
 import shutil
 import string
-import types
-import time
-import tempfile
+import StringIO
 import sys
+import tempfile
+import time
 import traceback
-import math
-from StringIO import StringIO
+import tree
+import types
 
-annotation_func = None
 
 annotations = []
 
+
 def print_annotation(name, value):
-    """Writes some named bit of information about test
-    run.
+    """Writes some named bits of information about test run.
     """
     print name + " {{{"
     print value
@@ -41,18 +40,23 @@
         print_annotation(ann[0], ann[1])
     annotations = []
 
+
 defer_annotations = 0
 
+
 def set_defer_annotations(n):
     global defer_annotations
     defer_annotations = n
 
+
 def annotation(name, value):
-    """Records an annotation about test run."""
+    """Records an annotation about the test run.
+    """
     annotations.append((name, value))
     if not defer_annotations:
         flush_annotations()
 
+
 def get_toolset():
     toolset = None;
     for arg in sys.argv[1:]:
@@ -60,17 +64,21 @@
             toolset = arg
     return toolset or 'gcc'
 
+
+# Detect the host OS.
 windows = 0
 if os.environ.get('OS','').lower().startswith('windows') or \
        os.__dict__.has_key('uname') and \
        os.uname()[0].lower().startswith('cygwin'):
     windows = 1
 
+
 suffixes = {}
 
+
 # Prepare the map of suffixes
 def prepare_suffix_map(toolset):
-    global windows, suffixes    
+    global windows, suffixes
     suffixes = {'.exe': '', '.dll': '.so', '.lib': '.a', '.obj': '.o'}
     suffixes['.implib'] = '.no_implib_files_on_this_platform'
     if windows:
@@ -82,6 +90,7 @@
     if os.__dict__.has_key('uname') and os.uname()[0] == 'Darwin':
         suffixes['.dll'] = '.dylib'
 
+
 def re_remove(sequence,regex):
     me = re.compile(regex)
     result = filter( lambda x: me.match(x), sequence )
@@ -90,6 +99,7 @@
     for r in result:
         sequence.remove(r)
 
+
 def glob_remove(sequence,pattern):
     result = fnmatch.filter(sequence,pattern)
     if 0 == len(result):
@@ -97,13 +107,15 @@
     for r in result:
         sequence.remove(r)
 
+
+# Configuration stating whether Boost Build is expected to automatically prepend
+# prefixes to built library targets.
 lib_prefix = 1
 dll_prefix = 1
 if windows:
-    #~ lib_prefix = 0
     dll_prefix = 0
-    
-    
+
+
 #
 # FIXME: this is copy-pasted from TestSCons.py
 # Should be moved to TestCmd.py?
@@ -126,25 +138,24 @@
     def _status(self):
         return self.status
 
+
 class Tester(TestCmd.TestCmd):
     """Class for testing Boost.Build.
 
-    Optional argument `executable` indicates the name of the
-    executable to invoke. Set this to "jam" to test Boost.Build v1
-    behavior.
+    Optional argument `executable` indicates the name of the executable to
+    invoke. Set this to "jam" to test Boost.Build v1 behavior.
 
-    Optional argument `work_dir` indicates an absolute directory, 
-    where the test will run be run.
+    Optional argument `work_dir` indicates an absolute directory, where the test
+    will run be run.
     """
     def __init__(self, arguments="", executable = 'bjam', match =
                  TestCmd.match_exact, boost_build_path = None,
                  translate_suffixes = 1, pass_toolset = 1,
-                 workdir = '',
-                 **keywords):
+                 workdir = '', **keywords):
 
         self.original_workdir = os.getcwd()
         if workdir != '' and not os.path.isabs(workdir):
-            raise "Parameter workdir <"+workdir+"> must point to a absolute directory: "
+            raise "Parameter workdir <"+workdir+"> must point to an absolute directory: "
 
         self.last_build_time = 0
         self.translate_suffixes = translate_suffixes
@@ -187,17 +198,14 @@
             else:
                 raise "Don't know directory where jam is build for this system: " + os.name
 
-            # Find there jam_src is located.
-            # try for the debug version if it's lying around
-
+            # Find where jam_src is located. Try for the debug version if it's
+            # lying around.
             dirs = [os.path.join('../../../jam/src', jam_build_dir + '.debug'),
                     os.path.join('../../../jam/src', jam_build_dir),
                     os.path.join('../../jam_src', jam_build_dir + '.debug'),
                     os.path.join('../../jam_src', jam_build_dir),
                     os.path.join('../jam_src', jam_build_dir + '.debug'),
-                    os.path.join('../jam_src', jam_build_dir),
-                    ]
-
+                    os.path.join('../jam_src', jam_build_dir)]
             for d in dirs:
                 if os.path.exists(d):
                     jam_build_dir = d
@@ -215,7 +223,7 @@
             boost_build_path = self.original_workdir
 
         program_list = []
-        
+
         if '--default-bjam' in sys.argv:
             program_list.append(executable)
             inpath_bjam = True
@@ -225,7 +233,7 @@
         program_list.append('-sBOOST_BUILD_PATH=' + boost_build_path)
         if verbosity:
             program_list += verbosity
-        program_list += ["--ignore-toolset-requirements"]            
+        program_list += ["--ignore-toolset-requirements"]
         if arguments:
             program_list += arguments.split(" ")
 
@@ -244,22 +252,22 @@
             TestCmd.TestCmd.cleanup(self)
             os.chdir(self.original_workdir)
         except AttributeError:
-            # Whe this is called during by TestCmd.TestCmd.__del__ we can have both
-            # 'TestCmd' and 'os' unavailable in our scope. Do nothing in this case.
+            # When this is called during by TestCmd.TestCmd.__del__ we can have
+            # both 'TestCmd' and 'os' unavailable in our scope. Do nothing in
+            # this case.
             pass
-            
+
     #
-    # Methods that change working directory's content
+    # Methods that change the working directory's content.
     #
     def set_tree(self, tree_location):
-        # Seem like it's not possible to remove a directory which is
-        # current.
+        # Seems like it's not possible to remove the current a directory.
         d = os.getcwd()
         os.chdir(os.path.dirname(self.workdir))
         shutil.rmtree(self.workdir, ignore_errors=0)
 
         if not os.path.isabs(tree_location):
-                tree_location = os.path.join(self.original_workdir, tree_location)
+            tree_location = os.path.join(self.original_workdir, tree_location)
         shutil.copytree(tree_location, self.workdir)
 
         os.chdir(d)
@@ -271,7 +279,6 @@
 
         os.path.walk(".", make_writable, None)
 
-
     def write(self, file, content):
         self.wait_for_time_change()
         nfile = self.native_file_name(file)
@@ -286,12 +293,12 @@
             os.makedirs(os.path.dirname(new))
         except:
             pass
-        
+
         try:
             os.remove(new)
         except:
             pass
-        
+
         os.rename(old, new)
         self.touch(new);
 
@@ -305,10 +312,10 @@
     def copy_preserving_timestamp(self, src, dst):
         src_name = self.native_file_name(src)
         dst_name = self.native_file_name(dst)
-        stats = os.stat(src_name)        
+        stats = os.stat(src_name)
         self.write(dst, self.read(src, 1))
         os.utime(dst_name, (stats.st_atime, stats.st_mtime))
-        
+
     def touch(self, names):
         self.wait_for_time_change()
         for name in self.adjust_names(names):
@@ -319,7 +326,7 @@
         if not type(names) == types.ListType:
             names = [names]
 
-        # Avoid attempts to remove current dir
+        # Avoid attempts to remove the current directory.
         os.chdir(self.original_workdir)
         for name in names:
             n = self.native_file_name(name)
@@ -333,8 +340,7 @@
                 else:
                     os.unlink(n)
 
-        # Create working dir root again, in case
-        # we've removed it
+        # Create working dir root again, in case we've removed it.
         if not os.path.exists(self.workdir):
             os.mkdir(self.workdir)
         os.chdir(self.workdir)
@@ -344,17 +350,17 @@
         content = self.read(name)
         content = string.replace(content, "$toolset", self.toolset)
         self.write(name, content)
-                                                        
+
     def dump_stdio(self):
         annotation("STDOUT", self.stdout())
         annotation("STDERR", self.stderr())
-                    
+
     #
     #   FIXME: Large portion copied from TestSCons.py, should be moved?
     #
     def run_build_system(
-        self, extra_args='', subdir='', stdout = None, stderr = '',
-        status = 0, match = None, pass_toolset = None, **kw):
+        self, extra_args='', subdir='', stdout = None, stderr = '', status = 0,
+        match = None, pass_toolset = None, **kw):
 
         if os.path.isabs(subdir):
             if stderr:
@@ -362,13 +368,13 @@
             status = 1
             return
 
-        self.previous_tree = build_tree(self.workdir)
+        self.previous_tree = tree.build_tree(self.workdir)
 
         if match is None:
             match = self.match
 
         if pass_toolset is None:
-            pass_toolset = self.pass_toolset        
+            pass_toolset = self.pass_toolset
 
         try:
             kw['program'] = []
@@ -388,14 +394,14 @@
             if status != 0:
                 expect = " (expected %d)" % status
 
-            annotation("failed command", '"%s" returned %d%s' % (
-                kw['program'], _status(self), expect))
+            annotation("failure", '"%s" returned %d%s'
+                % (kw['program'], _status(self), expect))
 
             annotation("reason", "error returned by bjam")
             self.fail_test(1)
 
         if not stdout is None and not match(self.stdout(), stdout):
-            annotation("reason", "Unexpected stdout")
+            annotation("failure", "Unexpected stdout")
             annotation("Expected STDOUT", stdout)
             annotation("Actual STDOUT", self.stdout())
             stderr = self.stderr()
@@ -404,26 +410,25 @@
             self.maybe_do_diff(self.stdout(), stdout)
             self.fail_test(1, dump_stdio = 0)
 
-        # Intel tends to produce some message to stderr, which makes tests
-        # fail
+        # Intel tends to produce some message to stderr which makes tests fail.
         intel_workaround = re.compile("^xi(link|lib): executing.*\n", re.M)
         actual_stderr = re.sub(intel_workaround, "", self.stderr())
 
         if not stderr is None and not match(actual_stderr, stderr):
-            annotation("reason", "Unexpected stderr")
+            annotation("failure", "Unexpected stderr")
             annotation("Expected STDERR", stderr)
             annotation("Actual STDERR", self.stderr())
             annotation("STDOUT", self.stdout())
             self.maybe_do_diff(actual_stderr, stderr)
             self.fail_test(1, dump_stdio = 0)
 
-        self.tree = build_tree(self.workdir)
-        self.difference = trees_difference(self.previous_tree, self.tree)
+        self.tree = tree.build_tree(self.workdir)
+        self.difference = tree.trees_difference(self.previous_tree, self.tree)
         self.difference.ignore_directories()
         self.unexpected_difference = copy.deepcopy(self.difference)
 
         self.last_build_time = time.time()
-    
+
     def glob_file(self, name):
         result = None
         if hasattr(self,'difference'):
@@ -449,7 +454,7 @@
                 openMode += "U"
             return open(name, openMode).read()
         except:
-            annotation("reason", "Could not open '%s'" % name)
+            annotation("failure", "Could not open '%s'" % name)
             self.fail_test(1)
             return ''
 
@@ -460,68 +465,69 @@
             return result + '\n'
         else:
             return result
-    
+
     def fail_test(self, condition, dump_stdio = 1, *args):
-        # If test failed, print the difference        
-        if condition and hasattr(self, 'difference'):            
-            f = StringIO()
+        if not condition:
+            return
+
+        if hasattr(self, 'difference'):
+            f = StringIO.StringIO()
             self.difference.pprint(f)
             annotation("changes caused by the last build command", f.getvalue())
-            
-        if condition and dump_stdio:
+
+        if dump_stdio:
             self.dump_stdio()
 
-        if condition and '--preserve' in sys.argv:
-            print 
+        if '--preserve' in sys.argv:
+            print
             print "*** Copying the state of working dir into 'failed_test' ***"
-            print 
+            print
             path = os.path.join(self.original_workdir, "failed_test")
             if os.path.isdir(path):
                 shutil.rmtree(path, ignore_errors=0)
             elif os.path.exists(path):
-                raise "The path " + path + " already exists and is not directory";
+                raise "Path " + path + " already exists and is not a directory";
             shutil.copytree(self.workdir, path)
 
-        if condition:
-            at = TestCmd.caller(traceback.extract_stack(), 0)
-            annotation("stacktrace", at)
-            sys.exit(1)
-        
+        at = TestCmd.caller(traceback.extract_stack(), 0)
+        annotation("stacktrace", at)
+        sys.exit(1)
+
     # A number of methods below check expectations with actual difference
-    # between directory trees before and after build.
-    # All the 'expect*' methods require exact names to be passed.
-    # All the 'ignore*' methods allow wildcards.
+    # between directory trees before and after a build. All the 'expect*'
+    # methods require exact names to be passed. All the 'ignore*' methods allow
+    # wildcards.
 
-    # All names can be lists, which are taken to be directory components
-    def expect_addition(self, names):        
+    # All names can be lists, which are taken to be directory components.
+    def expect_addition(self, names):
         for name in self.adjust_names(names):
-                try:
-                        glob_remove(self.unexpected_difference.added_files,name)
-                except:
-                        print "File %s not added as expected" % (name,)
-                        self.fail_test(1)
+            try:
+                glob_remove(self.unexpected_difference.added_files,name)
+            except:
+                print "File %s not added as expected" % name
+                self.fail_test(1)
 
     def ignore_addition(self, wildcard):
         self.ignore_elements(self.unexpected_difference.added_files, wildcard)
 
     def expect_removal(self, names):
         for name in self.adjust_names(names):
-                try:
-                        glob_remove(self.unexpected_difference.removed_files,name)
-                except:
-                        print "File %s not removed as expected" % (name,)
-                        self.fail_test(1)
+            try:
+                glob_remove(self.unexpected_difference.removed_files,name)
+            except:
+                print "File %s not removed as expected" % name
+                self.fail_test(1)
 
     def ignore_removal(self, wildcard):
         self.ignore_elements(self.unexpected_difference.removed_files, wildcard)
 
     def expect_modification(self, names):
         for name in self.adjust_names(names):
-                try:
-                        glob_remove(self.unexpected_difference.modified_files,name)
-                except:
-                        print "File %s not modified as expected" % (name,)
-                        self.fail_test(1)
+            try:
+                glob_remove(self.unexpected_difference.modified_files,name)
+            except:
+                print "File %s not modified as expected" % name
+                self.fail_test(1)
 
     def ignore_modification(self, wildcard):
         self.ignore_elements(self.unexpected_difference.modified_files, wildcard)
@@ -529,12 +535,12 @@
     def expect_touch(self, names):
         d = self.unexpected_difference
         for name in self.adjust_names(names):
-
-            # We need to check in both touched and modified files.
-            # The reason is that:
-            # (1) for windows binaries often have slight
-            # differences even with identical inputs
-            # (2) Intel's compiler for Linux has the same behaviour        
+            # We need to check both touched and modified files. The reason is
+            # that:
+            #   (1) Windows binaries such as obj, exe or dll files have slight
+            #       differences even with identical inputs due to Windows PE
+            #       format headers containing an internal timestamp.
+            #   (2) Intel's compiler for Linux has the same behaviour.
             filesets = [d.modified_files, d.touched_files]
 
             while filesets:
@@ -562,42 +568,42 @@
     def expect_nothing(self, names):
         for name in self.adjust_names(names):
             if name in self.difference.added_files:
-                annotation("reason",
-                           "File %s is added, but no action was expected" % (name,))
+                annotation("failure",
+                    "File %s added, but no action was expected" % name)
                 self.fail_test(1)
             if name in self.difference.removed_files:
-                annotation("reason",
-                           "File %s is removed, but no action was expected" % (name,))
+                annotation("failure",
+                    "File %s removed, but no action was expected" % name)
                 self.fail_test(1)
                 pass
             if name in self.difference.modified_files:
-                annotation("reason",
-                           "File %s is modified, but no action was expected" % (name,))
+                annotation("failure",
+                    "File %s modified, but no action was expected" % name)
                 self.fail_test(1)
             if name in self.difference.touched_files:
-                annotation("reason",
-                           "File %s is touched, but no action was expected" % (name,))
+                annotation("failure",
+                    "File %s touched, but no action was expected" % name)
                 self.fail_test(1)
 
     def expect_nothing_more(self):
-
-        # not totally sure about this change, but I don't see a good alternative
+        # Not totally sure about this change, but I don't see a good
+        # alternative.
         if windows:
-            self.ignore('*.ilk') # msvc incremental linking files
-            self.ignore('*.pdb') # msvc program database files
-            self.ignore('*.rsp') # response files
-            self.ignore('*.tds') # borland debug symbols
-            self.ignore('*.manifest') # msvc DLL manifests
+            self.ignore('*.ilk')       # MSVC incremental linking files.
+            self.ignore('*.pdb')       # MSVC program database files.
+            self.ignore('*.rsp')       # Response files.
+            self.ignore('*.tds')       # Borland debug symbols.
+            self.ignore('*.manifest')  # MSVC DLL manifests.
 
-        # debug builds of bjam built with gcc produce this profiling data
+        # Debug builds of bjam built with gcc produce this profiling data.
         self.ignore('gmon.out')
         self.ignore('*/gmon.out')
-            
+
         if not self.unexpected_difference.empty():
-           print 'FAILED'
-           print '------- The following changes were unexpected ------- '
-           self.unexpected_difference.pprint()
-           self.fail_test(1)
+            print 'FAILED'
+            print '------- The following changes were unexpected -------'
+            self.unexpected_difference.pprint()
+            self.fail_test(1)
 
     def _expect_line(self, content, expected):
         expected = expected.strip()
@@ -610,10 +616,9 @@
                 break
 
         if not found:
-            print "Did not found expected line in output:"
-            print expected
-            print "The output was:"
-            print content
+            annotation( "failure",
+                "Did not find expected line:\n%s\nin output:\n%s" %
+                (expected, content))
             self.fail_test(1)
 
     def expect_output_line(self, expected):
@@ -635,7 +640,6 @@
             print "Note: could not open file", name
             self.fail_test(1)
         return result
-            
 
     def expect_content(self, name, content, exact=0):
         actual = self._read_file(name, exact)
@@ -674,11 +678,11 @@
             if os.system("diff -u " + e + " " + a):
                 print "Unable to compute difference: diff -u %s %s" % (e,a)
             os.unlink(e)
-            os.unlink(a)    
+            os.unlink(a)
         else:
-            print "Set environmental variable 'DO_DIFF' to examine difference." 
+            print "Set environmental variable 'DO_DIFF' to examine difference."
 
-    # Helpers
+    # Helpers.
     def mul(self, *arguments):
         if len(arguments) == 0:
                 return None
@@ -697,9 +701,7 @@
                 else:
                         return here
 
-
-
-    # Internal methods
+    # Internal methods.
     def ignore_elements(self, list, wildcard):
         """Removes in-place, element of 'list' that match the given wildcard."""
         list[:] = filter(lambda x, w=wildcard: not fnmatch.fnmatch(x, w), list)
@@ -707,7 +709,7 @@
     def adjust_lib_name(self, name):
         global lib_prefix
         result = name
-        
+
         pos = string.rfind(name, ".")
         if pos != -1:
             suffix = name[pos:]
@@ -721,15 +723,15 @@
                 if dll_prefix:
                     tail = "lib" + tail
                     result = os.path.join(head, tail)
-        # If we try to use this name in Jamfile, we better
-        # convert \ to /, as otherwise we'd have to quote \.
+        # If we want to use this name in a Jamfile, we better convert \ to /, as
+        # otherwise we'd have to quote \.
         result = string.replace(result, "\\", "/")
         return result
-                
+
     def adjust_suffix(self, name):
         if not self.translate_suffixes:
             return name
-        
+
         pos = string.rfind(name, ".")
         if pos != -1:
             suffix = name[pos:]
@@ -742,7 +744,7 @@
 
         return name + suffix
 
-    # Acceps either string of list of string and returns list of strings
+    # Acceps either a string or a list of strings and returns a list of strings.
     # Adjusts suffixes on all names.
     def adjust_names(self, names):
         if type(names) == types.StringType:
@@ -762,29 +764,27 @@
     def wait_for_time_change(self):
         while 1:
             f = time.time();
-            # In fact, I'm not sure why "+ 2" as opposed to "+ 1" is
-            # needed but empirically, "+ 1" sometimes causes 'touch'
-            # and other functions not to bump file time enough for
-            # rebuild to happen.
+            # In fact, I'm not sure why "+ 2" as opposed to "+ 1" is needed but
+            # empirically, "+ 1" sometimes causes 'touch' and other functions
+            # not to bump the file time enough for a rebuild to happen.
             if math.floor(f) < math.floor(self.last_build_time) + 2:
                 time.sleep(0.1)
             else:
                 break
-            
 
-            
+
 class List:
 
     def __init__(self, s=""):
         elements = []
-        if isinstance(s, type("")):          
-            # Have to handle espaced spaces correctly
+        if isinstance(s, type("")):
+            # Have to handle espaced spaces correctly.
             s = string.replace(s, "\ ", '\001')
             elements = string.split(s)
         else:
             elements = s;
-            
-        self.l = []            
+
+        self.l = []
         for e in elements:
             self.l.append(string.replace(e, '\001', ' '))
 
@@ -808,7 +808,7 @@
                  + repr(string.join(self.l, ' '))
                  + ')')
 
-    def __mul__(self, other):        
+    def __mul__(self, other):
         result = List()
         if not isinstance(other, List):
             other = List(other)
@@ -819,7 +819,7 @@
 
     def __rmul__(self, other):
         if not isinstance(other, List):
-            other = List(other)        
+            other = List(other)
         return List.__mul__(other, self)
 
     def __add__(self, other):
@@ -827,12 +827,8 @@
         result.l = self.l[:] + other.l[:]
         return result
 
-# quickie tests. Should use doctest instead.
+# Quickie tests. Should use doctest instead.
 if __name__ == '__main__':
     assert str(List("foo bar") * "/baz") == "['foo/baz', 'bar/baz']"
     assert repr("foo/" * List("bar baz")) == "__main__.List('foo/bar foo/baz')"
     print 'tests passed'
-
-
-
-
Modified: trunk/tools/build/v2/test/alias.py
==============================================================================
--- trunk/tools/build/v2/test/alias.py	(original)
+++ trunk/tools/build/v2/test/alias.py	2008-01-05 15:37:44 EST (Sat, 05 Jan 2008)
@@ -1,17 +1,14 @@
 #!/usr/bin/python
 
-# Copyright 2003 Dave Abrahams 
-# Copyright 2003 Vladimir Prus 
-# Distributed under the Boost Software License, Version 1.0. 
-# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) 
+# Copyright 2003 Dave Abrahams
+# Copyright 2003 Vladimir Prus
+# Distributed under the Boost Software License, Version 1.0.
+# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 
 from BoostBuild import Tester, List
 t = Tester()
 
-# Test that top-level project can affect build dir
-t.write("project-root.jam", "")
-t.write("Jamfile", """
-
+t.write("Jamroot.jam", """
 exe a : a.cpp ;
 exe b : b.cpp ;
 exe c : c.cpp ;
@@ -21,32 +18,30 @@
 
 alias src : s.cpp ;
 exe hello : hello.cpp src ;
-
 """)
+
 t.write("a.cpp", "int main() { return 0; }\n")
 t.copy("a.cpp", "b.cpp")
 t.copy("a.cpp", "c.cpp")
 t.copy("a.cpp", "hello.cpp")
 t.write("s.cpp", "")
 
-# Check that targets to which "bin1" refers are updated,
-# and only those.
+# Check that targets to which "bin1" refers are updated, and only those.
 t.run_build_system("bin1")
-t.ignore("*.tds")
 t.expect_addition(List("bin/$toolset/debug/") * "a.exe a.obj")
 t.expect_nothing_more()
 
 # Try again with "bin2"
 t.run_build_system("bin2")
-t.ignore("*.tds")
 t.expect_addition(List("bin/$toolset/debug/") * "b.exe b.obj")
 t.expect_nothing_more()
 
-# Try building everything, making sure 'hello' target is
-# created
+# Try building everything, making sure 'hello' target is created.
 t.run_build_system()
-t.ignore("*.tds")
-t.expect_addition("bin/$toolset/debug/hello.exe")
+t.expect_addition(List("bin/$toolset/debug/") * "hello.exe hello.obj")
+t.expect_addition("bin/$toolset/debug/s.obj")
+t.expect_addition(List("bin/$toolset/debug/") * "c.exe c.obj")
+t.expect_nothing_more()
 
 # Regression test.
 # Check if usage requirements are propagated via "alias"
@@ -57,10 +52,9 @@
 __declspec(dllexport)
 #endif
 foo() {}
-
 """)
 
-t.write("Jamfile", """ 
+t.write("Jamroot.jam", """ 
 lib l : l.cpp : : : <define>WANT_MAIN ;
 alias la : l ;
 exe main : main.cpp la ; 
@@ -70,11 +64,8 @@
 #ifdef WANT_MAIN
 int main() { return 0; }
 #endif
-
 """)
 
-t.write("project-root.jam", "")
-
 t.run_build_system()
 
 t.cleanup()
Modified: trunk/tools/build/v2/tools/qt4.jam
==============================================================================
--- trunk/tools/build/v2/tools/qt4.jam	(original)
+++ trunk/tools/build/v2/tools/qt4.jam	2008-01-05 15:37:44 EST (Sat, 05 Jan 2008)
@@ -492,17 +492,18 @@
         
         local r = [ virtual-target.register $(target) ] ;
  
-        # Since this generator will return H target, the linking generator
-        # won't use it at all, and won't set any dependency on it.
-        # However, we need to target to be seen by bjam, so that dependency
-        # from sources to this generated header is detected -- if jam does
-        # not know about this target, it won't do anything.
+        # Since this generator will return a H target, the linking generator
+        # won't use it at all, and won't set any dependency on it. However, we
+        # need the target to be seen by bjam, so that dependency from sources to
+        # this generated header is detected -- if jam does not know about this
+        # target, it won't do anything.
         DEPENDS all : [ $(r).actualize ] ;
         
         return $(r) ;
     }    
 }
 
+
 class moc-h-generator : generator
 {
     rule __init__ ( * : * )
@@ -525,17 +526,19 @@
             
             local r = [ virtual-target.register $(target) ] ;
             
-            # Since this generator will return H target, the linking generator
-            # won't use it at all, and won't set any dependency on it.
-            # However, we need to target to be seen by bjam, so that dependency
-            # from sources to this generated header is detected -- if jam does
-            # not know about this target, it won't do anything.
+            # Since this generator will return a H target, the linking generator
+            # won't use it at all, and won't set any dependency on it. However,
+            # we need the target to be seen by bjam, so that dependency from
+            # sources to this generated header is detected -- if jam does not
+            # know about this target, it won't do anything.
             DEPENDS all : [ $(r).actualize ] ;
             
             return $(r) ;
         }        
     }
 }
+
+
 class moc-inc-generator : generator
 {
     rule __init__ ( * : * )
@@ -556,11 +559,11 @@
             local target = [ 
               new file-target moc_$(name) : CPP : $(project) : $(a) ] ;
             
-            # Since this generator will return H target, the linking generator
-            # won't use it at all, and won't set any dependency on it.
-            # However, we need to target to be seen by bjam, so that dependency
-            # from sources to this generated header is detected -- if jam does
-            # not know about this target, it won't do anything.
+            # Since this generator will return a H target, the linking generator
+            # won't use it at all, and won't set any dependency on it. However,
+            # we need the target to be seen by bjam, so that dependency from
+            # sources to this generated header is detected -- if jam does not
+            # know about this target, it won't do anything.
             DEPENDS all : [ $(target).actualize ] ;
             
             return [ virtual-target.register $(target) ] ;
@@ -568,18 +571,20 @@
     }    
 }
 
-# Query the installation directory
-# This is needed in at least two scenarios
-# First, when re-using sources from the Qt-Tree.
-# Second, to "install" custom Qt plugins to the Qt-Tree.
+
+# Query the installation directory. This is needed in at least two scenarios.
+# First, when re-using sources from the Qt-Tree. Second, to "install" custom Qt
+# plugins to the Qt-Tree.
 rule directory
 {
     return $(.prefix) ;
 }
 
+
 # Get <include> and <defines> from current toolset
 flags qt4.moc INCLUDES <include> ;
-flags qt4.moc DEFINES  <define> ;
+flags qt4.moc DEFINES <define> ;
+
 
 # Processes headers to create Qt MetaObject information
 # Qt4-moc has its c++-parser, so pass INCLUDES and DEFINES.
@@ -588,6 +593,7 @@
     $(.binprefix)/moc -I$(INCLUDES) -D$(DEFINES) -f $(>) -o $(<)
 }
 
+
 # When moccing files for include only, we don't need -f, 
 # otherwise the generated code will include the .cpp 
 # and we'll get duplicated symbols.
@@ -603,12 +609,14 @@
     $(.binprefix)/rcc $(>) -name $(>:B) -o $(<)
 }
 
+
 # Generates user-interface source from .ui files
 actions uic-h
 {
     $(.binprefix)/uic $(>) -o $(<)
 }
 
+
 # Scanner for .qrc files.
 # Look for the CDATA section of the <file> tag.
 # Ignore the "alias" attribute.