Commit baa84f06 authored by Samuel Debionne's avatar Samuel Debionne

Move python source files to have the same folder structure than the install.

Add a post build step to copy the camera python source to the root python folder.

Simplify the install and allows testing without installing first.
parent dc911c17
Pipeline #2993 passed with stages
in 2 minutes and 7 seconds
......@@ -553,8 +553,8 @@ if(LIMA_ENABLE_PYTHON)
${CMAKE_CURRENT_SOURCE_DIR}/third-party/Processlib/sip)
target_link_libraries(python_module_limacore limacore)
install(FILES python/__init__.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima")
install(FILES common/python/__init__.py common/python/Debug.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Core")
add_custom_command(TARGET lima${NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/python/Lima ${CMAKE_BINARY_DIR}/python/Lima)
install(DIRECTORY python/Lima/ DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima")
endif()
#--------------------------------------------------------------------------------
......
......@@ -49,6 +49,7 @@ endif()
if (LIMA_ENABLE_PYTHON)
limatools_run_sip_for_camera(${NAME})
add_custom_command(TARGET lima${NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/python ${CMAKE_BINARY_DIR}/python/Lima/Simulator)
install(FILES python/__init__.py DESTINATION "${PYTHON_SITE_PACKAGES_DIR}/Lima/Simulator")
endif()
......
......@@ -55,9 +55,9 @@ function(limatools_run_camera_python_tests test_src cam_name)
if(WIN32)
# Add the dlls to the %PATH%
string(REPLACE ";" "\;" ESCAPED_PATH "$ENV{PATH}")
set_tests_properties(${file} PROPERTIES ENVIRONMENT "PATH=${ESCAPED_PATH}\;$<SHELL_PATH:$<TARGET_FILE_DIR:limacore>>\;$<SHELL_PATH:$<TARGET_FILE_DIR:processlib>>\;$<SHELL_PATH:$<TARGET_FILE_DIR:lima${cam_name}>>;PYTHONPATH=$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_limacore>>\;$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_processlib>>\;$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_lima${cam_name}>>")
set_tests_properties(${file} PROPERTIES ENVIRONMENT "PATH=${ESCAPED_PATH}\;$<SHELL_PATH:$<TARGET_FILE_DIR:limacore>>\;$<SHELL_PATH:$<TARGET_FILE_DIR:processlib>>\;$<SHELL_PATH:$<TARGET_FILE_DIR:lima${cam_name}>>;PYTHONPATH=$<SHELL_PATH:${CMAKE_BINARY_DIR}/python>\;$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_limacore>>\;$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_processlib>>\;$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_lima${cam_name}>>")
else()
set_tests_properties(${file} PROPERTIES ENVIRONMENT "PYTHONPATH=$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_limacore>>:$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_processlib>>:$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_lima${cam_name}>>")
set_tests_properties(${file} PROPERTIES ENVIRONMENT "PYTHONPATH=$<SHELL_PATH:${CMAKE_BINARY_DIR}/python>:$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_limacore>>:$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_processlib>>:$<SHELL_PATH:$<TARGET_FILE_DIR:python_module_lima${cam_name}>>")
endif()
endforeach(file)
......
import sys
from Lima import processlib as Processlib
sys.modules['processlib'] = sys.modules['Lima.processlib']
sys.modules['Lima.processlib'] = None
from Lima.limacore import *
sys.modules['limacore'] = sys.modules['Lima.limacore']
sys.modules['Lima.limacore'] = None
from Lima.Debug import *
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment