From: stevenknight Date: Tue, 4 Oct 2005 12:57:28 +0000 (+0000) Subject: Add $CONFIGURELOG and $CONFIGUREDIR values to support specification of the configurat... X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=953a9fd811fe0a9dc88496378e6bae3ad2b075db;p=scons.git Add $CONFIGURELOG and $CONFIGUREDIR values to support specification of the configuration log file and directory for configuration tests. git-svn-id: http://scons.tigris.org/svn/scons/trunk@1357 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- diff --git a/doc/man/scons.1 b/doc/man/scons.1 index cf60e6c7..a0b46940 100644 --- a/doc/man/scons.1 +++ b/doc/man/scons.1 @@ -4971,6 +4971,25 @@ called to transform the list before concatenation. env['_CPPINCFLAGS'] = '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDirs)} $)', .EE +.IP CONFIGUREDIR +The name of the directory in which +Configure context test files are written. +The default is +.B .sconf_temp +in the top-level directory +containing the +.B SConstruct +file. + +.IP CONFIGURELOG +The name of the Configure context log file. +The default is +.B config.log +in the top-level directory +containing the +.B SConstruct +file. + .IP CPPDEFINES A platform independent specification of C preprocessor definitions. The definitions will be added to command lines diff --git a/src/CHANGES.txt b/src/CHANGES.txt index fd264e0a..516fe98a 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -617,6 +617,11 @@ RELEASE 0.97 - XXX - Add a PathAccept validator to the list of new canned PathOption validators. + From Christoph Schulz: + + - Add support for $CONFIGUREDIR and $CONFIGURELOG variables to control + the directory and logs for configuration tests. + From Craig Scott: - Have the Fortran module emitter look for Fortan modules to be created diff --git a/src/engine/SCons/Defaults.py b/src/engine/SCons/Defaults.py index 5c9d5e7e..4fe8987f 100644 --- a/src/engine/SCons/Defaults.py +++ b/src/engine/SCons/Defaults.py @@ -345,6 +345,8 @@ class Variable_Method_Caller: ConstructionEnvironment = { 'BUILDERS' : {}, 'SCANNERS' : [], + 'CONFIGUREDIR' : '#/.sconf_temp', + 'CONFIGURELOG' : '#/config.log', 'CPPSUFFIXES' : SCons.Tool.CSuffixes, 'DSUFFIXES' : SCons.Tool.DSuffixes, 'IDLSUFFIXES' : SCons.Tool.IDLSuffixes, diff --git a/src/engine/SCons/Defaults.xml b/src/engine/SCons/Defaults.xml index 71f2f218..56957aa6 100644 --- a/src/engine/SCons/Defaults.xml +++ b/src/engine/SCons/Defaults.xml @@ -84,6 +84,31 @@ env['_CPPINCFLAGS'] = '$( ${_concat(INCPREFIX, CPPPATH, INCSUFFIX, __env__, RDir + + +The name of the directory in which +Configure context test files are written. +The default is +.sconf_temp +in the top-level directory +containing the +SConstruct +file. + + + + + +The name of the Configure context log file. +The default is +config.log +in the top-level directory +containing the +SConstruct +file. + + + A platform independent specification of C preprocessor definitions. diff --git a/src/engine/SCons/SConf.py b/src/engine/SCons/SConf.py index 703619bd..74fd5fab 100644 --- a/src/engine/SCons/SConf.py +++ b/src/engine/SCons/SConf.py @@ -329,8 +329,8 @@ class SConf: SConf run, we need to explicitely cache this error. """ - def __init__(self, env, custom_tests = {}, conf_dir='#/.sconf_temp', - log_file='#/config.log', config_h = None, _depth = 0): + def __init__(self, env, custom_tests = {}, conf_dir='$CONFIGUREDIR', + log_file='$CONFIGURELOG', config_h = None, _depth = 0): """Constructor. Pass additional tests in the custom_tests-dictinary, e.g. custom_tests={'CheckPrivate':MyPrivateTest}, where MyPrivateTest defines a custom test. @@ -346,9 +346,8 @@ class SConf: "Only one SConf object may be active at one time") self.env = env if log_file != None: - self.logfile = SConfFS.File(log_file) - else: - self.logfile = None + log_file = SConfFS.File(env.subst(log_file)) + self.logfile = log_file self.logstream = None self.lastTarget = None self.depth = _depth @@ -366,7 +365,7 @@ class SConf: } self.AddTests(default_tests) self.AddTests(custom_tests) - self.confdir = SConfFS.Dir(conf_dir) + self.confdir = SConfFS.Dir(env.subst(conf_dir)) self.calc = None if not config_h is None: config_h = SConfFS.File(config_h) diff --git a/test/Configure/CONFIGUREDIR.py b/test/Configure/CONFIGUREDIR.py new file mode 100644 index 00000000..20648866 --- /dev/null +++ b/test/Configure/CONFIGUREDIR.py @@ -0,0 +1,51 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001, 2002, 2003, 2004 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "test/Configure.py 0.96.D308 2005/09/25 12:59:35 knight" + +""" +Test that the configure context directory can be specified by +setting the $CONFIGUREDIR construction variable. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.write("SConstruct", """\ +def CustomTest(context): + context.Message('Executing Custom Test ... ') + context.Result(1) + +env = Environment(CONFIGUREDIR = 'custom_config_dir') +conf = Configure(env, custom_tests = {'CustomTest' : CustomTest}) +conf.CustomTest(); +env = conf.Finish() +""") + +test.run() + +test.must_exist('custom_config_dir') + +test.pass_test() diff --git a/test/Configure/CONFIGURELOG.py b/test/Configure/CONFIGURELOG.py new file mode 100644 index 00000000..3668cfaf --- /dev/null +++ b/test/Configure/CONFIGURELOG.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +# +# Copyright (c) 2001, 2002, 2003, 2004 The SCons Foundation +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# "Software"), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# + +__revision__ = "test/Configure.py 0.96.D308 2005/09/25 12:59:35 knight" + +""" +Test that the configure context log file name can be specified by +setting the $CONFIGURELOG construction variable. +""" + +import TestSCons + +test = TestSCons.TestSCons() + +test.write("SConstruct", """\ +def CustomTest(context): + context.Message('Executing Custom Test ...') + context.Result(1) + +env = Environment(CONFIGURELOG = 'custom.logfile') +conf = Configure(env, custom_tests = {'CustomTest' : CustomTest}) +conf.CustomTest(); +env = conf.Finish() +""") + +test.run() + +expect = """\ +file SConstruct,line 6: +\tConfigure(confdir = .sconf_temp) +scons: Configure: Executing Custom Test ... +scons: Configure: (cached) yes + + +""" + +test.must_match('custom.logfile', expect) + +test.pass_test()