if args:
nargs = nargs + self.subst_list(args)[0]
nkw = self.subst_kw(kw)
- nkw['called_from_env_method'] = 1
+ nkw['_depth'] = kw.get('_depth', 0) + 1
try:
nkw['custom_tests'] = self.subst_kw(nkw['custom_tests'])
except KeyError:
# Configure() will write to a local temporary file.
test = TestCmd.TestCmd(workdir = '')
save = os.getcwd()
- # Configure() will test, if we are reading a SConscript file
- import SCons.Script.SConscript
- SCons.Script.SConscript.sconscript_reading = 1
try:
os.chdir(test.workpath())
"""
def __init__(self, env, custom_tests = {}, conf_dir='#/.sconf_temp',
- log_file='#/config.log', config_h = None,
- called_from_env_method = 0):
+ log_file='#/config.log', 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.
Note also the conf_dir and log_file arguments (you may want to
build tests in the BuildDir, not in the SourceDir)
"""
- import SCons.Script.SConscript
- if not SCons.Script.SConscript.sconscript_reading:
- raise SCons.Errors.UserError, "Calling Configure from Builders is not supported."
global SConfFS
if not SConfFS:
SConfFS = SCons.Node.FS.FS(SCons.Node.FS.default_fs.pathTop)
self.logfile = None
self.logstream = None
self.lastTarget = None
- self.called_from_env_method = called_from_env_method
+ self.depth = _depth
self.cached = 0 # will be set, if all test results are cached
# add default tests
# existing file with the same name in the source directory
self.logfile.dir.add_ignore( [self.logfile] )
- tb = traceback.extract_stack()[-3-self.called_from_env_method]
+ tb = traceback.extract_stack()[-3-self.depth]
old_fs_dir = SConfFS.getcwd()
SConfFS.chdir(SConfFS.Top, change_os_dir=0)
self.logstream.write('file %s,line %d:\n\tConfigure(confdir = %s)\n' %
call = call, language = language, autoadd = autoadd)
context.did_show_result = 1
return not res
-
-
# we only use SCons.Environment and SCons.SConf for these tests.
import SCons.Environment
import SCons.SConf
- import SCons.Script.SConscript
- SCons.Script.SConscript.sconscript_reading = 1
self.Environment = SCons.Environment
self.SConf = SCons.SConf
# and we need a new environment, cause references may point to
# as global functions.
#
+ def Configure(self, *args, **kw):
+ if not SCons.Script.SConscript.sconscript_reading:
+ raise SCons.Errors.UserError, "Calling Configure from Builders is not supported."
+ kw['_depth'] = kw.get('_depth', 0) + 1
+ return apply(SCons.Environment.Base.Configure, (self,)+args, kw)
+
def Default(self, *targets):
global DefaultCalled
global DefaultTargets
def Options(files=None, args=Arguments):
return SCons.Options.Options(files, args)
+def Configure(*args, **kw):
+ if not SCons.Script.SConscript.sconscript_reading:
+ raise SCons.Errors.UserError, "Calling Configure from Builders is not supported."
+ kw['_depth'] = 1
+ return apply(SCons.SConf.SConf, args, kw)
+
#
_DefaultEnvironmentProxy = None
'Action' : SCons.Action.Action,
'BoolOption' : SCons.Options.BoolOption,
'Builder' : SCons.Builder.Builder,
- 'Configure' : SCons.SConf.SConf,
+ 'Configure' : Configure,
'EnumOption' : SCons.Options.EnumOption,
'Environment' : SCons.Environment.Environment,
'ListOption' : SCons.Options.ListOption,
"""
try:
- loadable_module = env['BUILDERS']['LoadableModule']
+ ld_module = env['BUILDERS']['LoadableModule']
except KeyError:
action_list = [ SCons.Defaults.SharedCheck,
SCons.Defaults.LdModuleLinkAction ]
import os.path
import SCons.Platform.aix
-import SCons.Script.SConscript
cplusplus = __import__('c++', globals(), locals(), [])
return SCons.Platform.aix.get_xlc(env, xlc, xlc_r, packages)
def smart_cxxflags(source, target, env, for_signature):
- build_dir = SCons.Script.SConscript.GetBuildPath()
+ build_dir = env.GetBuildPath()
if build_dir:
return '-qtempinc=' + os.path.join(build_dir, 'tempinc')
return ''
elif lang == 'C++':
return (".cc", _obj, _exe)
+class NoMatch:
+ def __init__(self, p):
+ self.pos = p
+
NCR = 0 # non-cached rebuild
CR = 1 # cached rebuild (up to date)
NCF = 2 # non-cached build failure
def checkLogAndStdout(checks, results, cached,
test, logfile, sconf_dir, sconstruct,
doCheckLog=1, doCheckStdout=1):
- class NoMatch:
- def __init__(self, p):
- self.pos = p
-
def matchPart(log, logfile, lastEnd):
m = re.match(log, logfile[lastEnd:])
if not m: