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

Class 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 explicitely. 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 explicitely cache this error.


Method Summary
  __init__(self, env, custom_tests, conf_dir, log_file, config_h, _depth)
Constructor.
  AddTest(self, test_name, test_instance)
Adds test_class to this SConf instance.
  AddTests(self, tests)
Adds all the tests given in the tests dictionary to this SConf instance
  BuildNodes(self, nodes)
Tries to build the given nodes immediately.
  Finish(self)
Call this method after finished with your tests: env = sconf.Finish()
  pspawn_wrapper(self, sh, escape, cmd, args, env)
Wrapper function for handling piped spawns.
  TryAction(self, action, text, 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.
  TryBuild(self, builder, text, extension)
Low level TryBuild implementation.
  TryCompile(self, text, extension)
Compiles the program given in text to an env.Object, using extension as file extension (e.g.
  TryLink(self, text, extension)
Compiles the program given in text to an executable env.Program, using extension as file extension (e.g.
  TryRun(self, text, extension)
Compiles and runs the program given in text, using extension as file extension (e.g.
  _createDir(self, node)
  _shutdown(self)
Private method.
  _startup(self)
Private method.

Class Variable Summary
classobj TestWrapper = SCons.SConf.TestWrapper

Method Details

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

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)

AddTest(self, test_name, test_instance)

Adds test_class to this SConf instance. It can be called with self.test_name(...)

AddTests(self, tests)

Adds all the tests given in the tests dictionary to this SConf instance

BuildNodes(self, nodes)

Tries to build the given nodes immediately. Returns 1 on success, 0 on error.

Finish(self)

Call this method after finished with your tests: env = sconf.Finish()

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

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.

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.

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

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).

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).

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).

_shutdown(self)

Private method. Reset to non-piped spawn

_startup(self)

Private method. Set up logstream, and set the environment variables necessary for a piped build


Generated by Epydoc 2.1 on Wed Dec 12 09:39:31 2007 http://epydoc.sf.net