Changeset 62162


Ignore:
Timestamp:
May 23, 2010, 8:10:14 AM (9 years ago)
Author:
Jim Bosch
Message:

boost.python extensions - basic functionality and tests for const_aware_class done; still need to add result converter for shared_ptr<const T>, more rigorous tests, and move the registry into a separate library.

Location:
sandbox/python_extensions
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • sandbox/python_extensions/libs/python/test/SConscript

    r62075 r62162  
    22
    33test_mod = bp_extensions_env.SharedLibrary("test_mod", "test_mod.cpp", SHLIBPREFIX="")
    4 test = bp_extensions_env.PythonUnitTest("test_script.py", test_mod)
     4const_aware_mod = bp_extensions_env.SharedLibrary("const_aware", "const_aware.cpp", SHLIBPREFIX="")
     5test = (
     6    bp_extensions_env.PythonUnitTest("test_script.py", test_mod)
     7    + bp_extensions_env.PythonUnitTest("const_aware.py", const_aware_mod)
     8    )
    59
    610Return("test")
  • sandbox/python_extensions/site_scons/scons_tools.py

    r62075 r62162  
    8383    def _check(self):
    8484        env = MakeEnvironment()
    85         context = scons.Configure(env)
    8685        try:
    8786            from distutils.sysconfig import get_config_vars, get_python_inc
     
    9998        self._flags.append("-I%s" % get_python_inc())
    10099        self._apply(env)
     100        context = scons.Configure(env)
    101101        if not context.CheckHeader(["Python.h"]):
     102            context.Finish()
    102103            return False
    103104        context.Finish()
     
    113114    def _check(self):
    114115        env = MakeEnvironment()
    115         context = scons.Configure(env)
    116         self._apply_dependencies(context.env)
     116        self._apply_dependencies(env)
    117117        try:
    118118            import numpy.distutils.misc_util
    119119            self._variables = {"CPPPATH": numpy.distutils.misc_util.get_numpy_include_dirs()}
    120120        except ImportError:
    121             context.Result(False)
    122             return False
    123         self._apply(context.env)
     121            context.Finish()
     122            return False
     123        self._apply(env)
     124        context = scons.Configure(env)
    124125        if not context.CheckHeader(["Python.h", "numpy/arrayobject.h"]):
    125126            return False
     
    140141    def _check(self):
    141142        env = MakeEnvironment()
     143        self._apply_dependencies(env)
     144        self._apply(env)
    142145        context = scons.Configure(env)
    143         self._apply_dependencies(context.env)
    144         self._apply(context.env)
    145146        if self._headers:
    146147            if not context.CheckHeader(self._headers, language="C++"):
     148                context.Finish()
    147149                return False
    148150        if self._libraries:
    149151            if not context.CheckLib(self._libraries, language="C++"):
     152                context.Finish()
    150153                return False
    151154            self._variables = {"LIBS": self._libraries}
     
    206209        libs = "boost_unit_test_framework"
    207210    bin = env.Program(name, source, LIBS=libs)
    208     run = env.Command(".%s.succeeded" % name, name, RunProgramUnitTest)
     211    run = env.Command(".%s.succeeded" % str(name), name, RunProgramUnitTest)
    209212    env.Depends(run, bin)
    210213    return run
    211214
    212215def PythonUnitTest(env, script, dependencies):
    213     run = env.Command(".%s.succeeded" % script, script, RunPythonUnitTest)
     216    run = env.Command(".%s.succeeded" % str(script), script, RunPythonUnitTest)
    214217    env.Depends(run, dependencies)
    215218    return run
     
    220223
    221224def MakeEnvironment():
    222     env = scons.Environment()
     225    env = scons.Environment(tools = ["default", "doxygen"])
     226    env.Append(CPPPATH="#include")
     227    env.Append(LIBPATH="#lib")
    223228    env.AddMethod(RecursiveInstall, "RecursiveInstall")
    224229    env.AddMethod(SetupPackages, "SetupPackages")
Note: See TracChangeset for help on using the changeset viewer.