Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68663 - trunk/tools/build/v2/tools
From: steven_at_[hidden]
Date: 2011-02-06 00:53:37


Author: steven_watanabe
Date: 2011-02-06 00:53:30 EST (Sun, 06 Feb 2011)
New Revision: 68663
URL: http://svn.boost.org/trac/boost/changeset/68663

Log:
Allow xsltproc configuration to be overridden. Add a check that we can run xsltproc.
Text files modified:
   trunk/tools/build/v2/tools/xsltproc.jam | 46 +++++++++++++++++++++++++++++++--------
   1 files changed, 36 insertions(+), 10 deletions(-)

Modified: trunk/tools/build/v2/tools/xsltproc.jam
==============================================================================
--- trunk/tools/build/v2/tools/xsltproc.jam (original)
+++ trunk/tools/build/v2/tools/xsltproc.jam 2011-02-06 00:53:30 EST (Sun, 06 Feb 2011)
@@ -16,6 +16,7 @@
 import os ;
 import modules ;
 import path ;
+import errors ;
 
 feature.feature xsl:param : : free ;
 feature.feature xsl:path : : free ;
@@ -27,26 +28,50 @@
 #
 rule init ( xsltproc ? )
 {
- if ! $(xsltproc)
+ if $(xsltproc)
     {
- xsltproc = [ modules.peek : XSLTPROC ] ;
+ modify-config ;
+ .xsltproc = $(xsltproc) ;
+ check-xsltproc ;
     }
+}
 
- if ! $(.initialized)
+rule freeze-config ( )
+{
+ if ! $(.config-frozen)
     {
- .initialized = true ;
- .xsltproc = $(xsltproc) ;
- .is-cygwin = [ .is-cygwin $(xsltproc:E=xsltproc) ] ;
+ .config-frozen = true ;
+ .xsltproc ?= [ modules.peek : XSLTPROC ] ;
+ .xsltproc ?= xsltproc ;
+ check-xsltproc ;
+ .is-cygwin = [ .is-cygwin $(.xsltproc) ] ;
     }
 }
 
-# Returns a non-empty string if a cygwin xsltproc binary was specified.
-rule is-cygwin ( )
+rule modify-config
 {
- if ! $(.initialized)
+ if $(.config-frozen)
     {
- init ;
+ errors.user-error "xsltproc: Cannot change xsltproc command after it has been used." ;
     }
+}
+
+rule check-xsltproc ( )
+{
+ if $(.xsltproc)
+ {
+ local status = [ SHELL "\"$(.xsltproc)\" -V" : no-output : exit-status ] ;
+ if $(status[2]) != "0"
+ {
+ errors.user-error "xsltproc: Could not run \"$(.xsltproc)\" -V." ;
+ }
+ }
+}
+
+# Returns a non-empty string if a cygwin xsltproc binary was specified.
+rule is-cygwin ( )
+{
+ freeze-config ;
     return $(.is-cygwin) ;
 }
 
@@ -115,6 +140,7 @@
 
 local rule .xsltproc ( target : source stylesheet : properties * : dirname ? : action )
 {
+ freeze-config ;
     STYLESHEET on $(target) = $(stylesheet) ;
     FLAGS on $(target) += [ compute-xslt-flags $(target) : $(properties) ] ;
     NAME on $(target) = $(.xsltproc) ;


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk