Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52255 - in trunk/libs/python: . test
From: troy_at_[hidden]
Date: 2009-04-08 11:46:15


Author: troy
Date: 2009-04-08 11:46:14 EDT (Wed, 08 Apr 2009)
New Revision: 52255
URL: http://svn.boost.org/trac/boost/changeset/52255

Log:

Tune up python tests for removal of our ctest hacks

Added:
   trunk/libs/python/test/pyrun.py (contents, props changed)
Text files modified:
   trunk/libs/python/CMakeLists.txt | 49 +++++++++++++++++----------------------
   trunk/libs/python/test/CMakeLists.txt | 9 ++----
   2 files changed, 25 insertions(+), 33 deletions(-)

Modified: trunk/libs/python/CMakeLists.txt
==============================================================================
--- trunk/libs/python/CMakeLists.txt (original)
+++ trunk/libs/python/CMakeLists.txt 2009-04-08 11:46:14 EDT (Wed, 08 Apr 2009)
@@ -40,36 +40,31 @@
       ""
       ${ARGN})
       
- #TODO: The target properties are NOT being set correctly for the test libraries
- if (FALSE)
- # Create the library target itself
- add_library(${MODULE_NAME} MODULE ${BPL_EXT_DEFAULT_ARGS} )
+ # Create the library target itself
+ add_library(${MODULE_NAME} MODULE ${BPL_EXT_DEFAULT_ARGS})
     
- # Miscellaneous target properties
- set_target_properties(${MODULE_NAME} PROPERTIES PREFIX "")
+ # Link against Boost.Python library
+ target_link_libraries(${MODULE_NAME} boost_python-mt-shared)
     
- # Link against Boost.Python library
- target_link_libraries(${MODULE_NAME} boost_python-static)
-
- # Link against Python libraries
- target_link_libraries(${MODULE_NAME} ${PYTHON_LIBRARIES})
- endif(FALSE)
+ # Link against Python libraries
+ target_link_libraries(${MODULE_NAME} ${PYTHON_LIBRARIES})
 
- boost_add_library(
- ${MODULE_NAME}
- ${BPL_EXT_DEFAULT_ARGS}
- MODULE
- LINK_LIBS ${PYTHON_LIBRARIES}
- DEPENDS boost_python
- NO_STATIC
- NO_SINGLE_THREADED
- )
-
- set_target_properties(${MODULE_NAME}-mt-shared
- PROPERTIES
- PREFIX ""
- OUTPUT_NAME ${MODULE_NAME}
- )
+ # boost_add_library(
+ # ${MODULE_NAME}
+ # ${BPL_EXT_DEFAULT_ARGS}
+ # MODULE
+ # LINK_LIBS ${PYTHON_LIBRARIES}
+ # DEPENDS boost_python
+ # NO_STATIC
+ # NO_SINGLE_THREADED
+ # )
+
+ set_target_properties(${MODULE_NAME}
+ PROPERTIES
+ PREFIX ""
+ OUTPUT_NAME ${MODULE_NAME}
+ LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/test
+ )
 
   endmacro(boost_python_extension)
 #--

Modified: trunk/libs/python/test/CMakeLists.txt
==============================================================================
--- trunk/libs/python/test/CMakeLists.txt (original)
+++ trunk/libs/python/test/CMakeLists.txt 2009-04-08 11:46:14 EDT (Wed, 08 Apr 2009)
@@ -36,15 +36,12 @@
   set(BPL_TEST_PYSOURCE ${CMAKE_CURRENT_SOURCE_DIR}/${BPL_TEST_PYSOURCE})
     
   # Run the test itself
- file(TO_NATIVE_PATH "${LIBRARY_OUTPUT_PATH}" PYTHONPATH)
+ file(TO_NATIVE_PATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/test" PYTHONPATH)
   if(WIN32 AND NOT UNIX)
     string(REPLACE "\\" "\\\\" PYTHONPATH "${PYTHONPATH}")
   endif(WIN32 AND NOT UNIX)
- add_test("${PROJECT_NAME}::${TESTNAME}"
- ${PYTHON_EXECUTABLE}
- "${CMAKE_CURRENT_SOURCE_DIR}/pyrun.py"
- "${PYTHONPATH}"
- ${BPL_TEST_PYSOURCE} ${BPL_TEST_ARGS})
+
+ add_test("Python::${TESTNAME}" ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/pyrun.py ${PYTHONPATH} ${BPL_TEST_PYSOURCE} ${BPL_TEST_ARGS})
 endmacro(bpl_test)
 
 macro(py_run TESTNAME)

Added: trunk/libs/python/test/pyrun.py
==============================================================================
--- (empty file)
+++ trunk/libs/python/test/pyrun.py 2009-04-08 11:46:14 EDT (Wed, 08 Apr 2009)
@@ -0,0 +1,7 @@
+import sys
+
+pythonpath = sys.argv[1]
+scriptfile = sys.argv[2]
+sys.argv = sys.argv[2:]
+sys.path.append(pythonpath)
+execfile(scriptfile)


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk