The CheckPython, CheckPythonHeaders and CheckPythonModule methods are not yet a part of SCons. The current code is viewable here. Adding CheckPython, CheckPythonModule and CheckPythonHeaders methods became a part of my Google Summer of Code project.

CheckPython method

CheckPython(minver) method checks if a python interpreter is found matching a given minimum version.

minver should be a tuple, eg. to check for python >= 2.4.2 pass (2,4,2) as minver.

If detection is successful, env['PYTHON'] is defined to point to the python that matches the minimum version constraint. In addition, PYTHON_VERSION is defined as 'MAJOR.MINOR' (eg. '2.4') of the actual python version found. Finally, pythondir and pyexecdir are defined, and point to the site-packages directories (architecture independent and architecture dependent respectively) appropriate for this python version.

CheckPythonHeaders method

CheckPythonHeaders method checks for headers necessary to compile python extensions. If successful, CPPPATH is augmented with paths for python headers.

This test requires that CheckPython was previously executed and successful.

CheckPythonModule method

CheckPythonModule(modulename) method checks for the existence of module 'modulename'.

This test requires that CheckPython was previously executed and successful.

$sconsscons:ReadingSConscriptfiles...CheckingforPython>=2.2.2...(cached)yesCheckingforCheaderfilePython.h...yesFoundPythonheaderfilesin:['/usr/include/python2.5']Checkingforpythonmodulemechanize...(cached)noModule'mechanize' not found