Package SCons :: Module SConf :: Class SConfBase
[hide private]
[frames] | no frames]

Class SConfBase

source code

object --+
         |
        SConfBase

This is simply a class to represent a configure context. After creating a SConf object, you can call any tests. After finished with your tests, be sure to call the Finish() method, which returns the modified environment. Some words about caching: In most cases, it is not necessary to cache Test results explicitly. Instead, we use the scons dependency checking mechanism. For example, if one wants to compile a test program (SConf.TryLink), the compiler is only called, if the program dependencies have changed. However, if the program could not be compiled in a former SConf run, we need to explicitly cache this error.
Nested Classes [hide private]
  TestWrapper
A wrapper around Tests (to ensure sanity)
Instance Methods [hide private]
 
__init__(self, env, custom_tests={}, conf_dir='$CONFIGUREDIR', log_file='$CONFIGURELOG', config_h=None, _depth=0)
Constructor. Pass additional tests in the custom_tests-dictionary, 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 VariantDir, not in the SourceDir)
source code
 
Finish(self)
Call this method after finished with your tests: env = sconf.Finish()
source code
 
Define(self, name, value=None, comment=None)
Define a pre processor symbol name, with the optional given value in the current config header.
source code
 
BuildNodes(self, nodes)
Tries to build the given nodes immediately. Returns 1 on success, 0 on error.
source code
 
pspawn_wrapper(self, sh, escape, cmd, args, env)
Wrapper function for handling piped spawns.
source code
 
TryBuild(self, builder, text=None, extension='')
Low level TryBuild implementation. Normally you don't need to call that - you can use TryCompile / TryLink / TryRun instead
source code
 
TryAction(self, action, text=None, extension='')
Tries to execute the given action with optional source file contents <text> and optional source file extension <extension>, Returns the status (0 : failed, 1 : ok) and the contents of the output file.
source code
 
TryCompile(self, text, extension)
Compiles the program given in text to an env.Object, using extension as file extension (e.g. '.c'). Returns 1, if compilation was successful, 0 otherwise. The target is saved in self.lastTarget (for further processing).
source code
 
TryLink(self, text, extension)
Compiles the program given in text to an executable env.Program, using extension as file extension (e.g. '.c'). Returns 1, if compilation was successful, 0 otherwise. The target is saved in self.lastTarget (for further processing).
source code
 
TryRun(self, text, extension)
Compiles and runs the program given in text, using extension as file extension (e.g. '.c'). Returns (1, outputStr) on success, (0, '') otherwise. The target (a file containing the program's stdout) is saved in self.lastTarget (for further processing).
source code
 
AddTest(self, test_name, test_instance)
Adds test_class to this SConf instance. It can be called with self.test_name(...)
source code
 
AddTests(self, tests)
Adds all the tests given in the tests dictionary to this SConf instance
source code
 
_createDir(self, node) source code
 
_startup(self)
Private method. Set up logstream, and set the environment variables necessary for a piped build
source code
 
_shutdown(self)
Private method. Reset to non-piped spawn
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, env, custom_tests={}, conf_dir='$CONFIGUREDIR', log_file='$CONFIGURELOG', config_h=None, _depth=0)
(Constructor)

source code 
Constructor. Pass additional tests in the custom_tests-dictionary, 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 VariantDir, not in the SourceDir)
Overrides: object.__init__

Define(self, name, value=None, comment=None)

source code 

Define a pre processor symbol name, with the optional given value in the current config header.

If value is None (default), then #define name is written. If value is not none, then #define name value is written.

comment is a string which will be put as a C comment in the header, to explain the meaning of the value (appropriate C comments /* and */ will be put automatically.

pspawn_wrapper(self, sh, escape, cmd, args, env)

source code 

Wrapper function for handling piped spawns.

This looks to the calling interface (in Action.py) like a "normal" spawn, but associates the call with the PSPAWN variable from the construction environment and with the streams to which we want the output logged. This gets slid into the construction environment as the SPAWN variable so Action.py doesn't have to know or care whether it's spawning a piped command or not.