Skip to content
Snippets Groups Projects
Commit 0a3cd90c authored by Utkarsh Ayachit's avatar Utkarsh Ayachit Committed by Kitware Robot
Browse files

Merge topic 'python-artifacts'


f0b7b335 install python artifacts

Acked-by: default avatarKitware Robot <kwrobot@kitware.com>
Acked-by: default avatarBen Boeckel <ben.boeckel@kitware.com>
Merge-request: !378
parents 0172ec81 f0b7b335
No related branches found
No related tags found
2 merge requests!650Revive paraview/release branch and update it to commit used for ParaView 5.12.0,!378install python artifacts
......@@ -46,22 +46,30 @@ function (superbuild_apple_install_python_module destination module search_paths
endif ()
endif ()
if (IS_DIRECTORY "${search_path}/${module}")
file(GLOB modules "${search_path}/${module}/*.py" "${search_path}/${module}/*.so")
foreach (submodule IN LISTS modules)
get_filename_component(submodule_name "${submodule}" NAME)
string(REGEX REPLACE "\\.(py|so)$" "" submodule_name "${submodule_name}")
superbuild_apple_install_python_module("${destination}"
"${submodule_name}" "${search_path}/${module}" "${location}/${module}")
endforeach ()
file(GLOB packages "${search_path}/${module}/*")
foreach (subpackage IN LISTS packages)
if (IS_DIRECTORY "${subpackage}" AND
NOT (subpackage STREQUAL "__pycache__" OR subpackage MATCHES ".*dSYM$"))
get_filename_component(subpackage_name "${subpackage}" NAME)
superbuild_apple_install_python_module("${destination}"
"${subpackage_name}" "${search_path}/${module}" "${location}/${module}")
file(GLOB contents RELATIVE "${search_path}/${module}" "${search_path}/${module}/*")
foreach (item_name IN LISTS contents)
set(item_path "${search_path}/${module}/${item_name}")
if (IS_DIRECTORY "${item_path}")
if (NOT (item_name STREQUAL "__pycache__" OR item_name MATCHES ".*dSYM$"))
superbuild_apple_install_python_module("${destination}"
"${item_name}" "${search_path}/${module}" "${location}/${module}")
endif()
else()
# not a directory, check if it's a Python module or arbitrary artifact
# file.
if (item_name MATCHES "\\.(py|so)$")
# it's a Python module; install it by a recursive call.
string(REGEX REPLACE "\\.(py|so)$" "" item_name "${item_name}")
superbuild_apple_install_python_module("${destination}"
"${item_name}" "${search_path}/${module}" "${location}/${module}")
else()
# an artifact file; install it.
file(INSTALL
FILES "${search_path}/${module}/${item_name}"
DESTINATION "${destination}/${location}/${module}")
endif()
endif ()
endforeach ()
endforeach()
endif ()
endforeach ()
endfunction ()
......@@ -25,6 +25,7 @@ function (superbuild_unix_install_python_module destination module search_paths
list(GET module_so 0 module_so)
endif()
endif ()
if (EXISTS "${module_so}")
execute_process(
COMMAND "${superbuild_python_executable}"
......@@ -39,27 +40,36 @@ function (superbuild_unix_install_python_module destination module search_paths
"${module_so}"
RESULT_VARIABLE res
ERROR_VARIABLE err)
if (res)
message(FATAL_ERROR "Failed to install Python module ${module}:\n${err}")
endif ()
endif ()
if (IS_DIRECTORY "${search_path}/${module}")
file(GLOB modules "${search_path}/${module}/*.py" "${search_path}/${module}/*.so")
foreach (submodule IN LISTS modules)
get_filename_component(submodule_name "${submodule}" NAME)
string(REGEX REPLACE "\\.(py|so)$" "" submodule_name "${submodule_name}")
superbuild_unix_install_python_module("${destination}"
"${submodule_name}" "${search_path}/${module}" "${location}/${module}")
endforeach ()
file(GLOB packages "${search_path}/${module}/*")
foreach (subpackage IN LISTS packages)
if (IS_DIRECTORY "${subpackage}" AND NOT subpackage STREQUAL "__pycache__")
get_filename_component(subpackage_name "${subpackage}" NAME)
file(GLOB contents RELATIVE "${search_path}/${module}" "${search_path}/${module}/*")
foreach (item_name IN LISTS contents)
set(item_path "${search_path}/${module}/${item_name}")
if (IS_DIRECTORY "${item_path}")
if (NOT item_name STREQUAL "__pycache__")
superbuild_unix_install_python_module("${destination}"
"${item_name}" "${search_path}/${module}" "${location}/${module}")
endif()
else()
# not a directory, check if it's a Python module or arbitrary artifact
# file.
if (item_name MATCHES "\\.(py|so)$")
# it's a Python module; install it by a recursive call.
string(REGEX REPLACE "\\.(py|so)$" "" item_name "${item_name}")
superbuild_unix_install_python_module("${destination}"
"${subpackage_name}" "${search_path}/${module}" "${location}/${module}")
"${item_name}" "${search_path}/${module}" "${location}/${module}")
else()
# an artifact file; install it.
file(INSTALL
FILES "${search_path}/${module}/${item_name}"
DESTINATION "${destination}/${location}/${module}")
endif()
endif ()
endforeach ()
endforeach()
endif ()
endforeach ()
endfunction ()
......@@ -45,21 +45,30 @@ function (superbuild_windows_install_python_module destination module search_pat
endif ()
endif ()
if (IS_DIRECTORY "${search_path}/${module}")
file(GLOB modules "${search_path}/${module}/*.py" "${search_path}/${module}/*.pyd")
foreach (submodule IN LISTS modules)
get_filename_component(submodule_name "${submodule}" NAME)
string(REGEX REPLACE "\\.(py|pyd)$" "" submodule_name "${submodule_name}")
superbuild_windows_install_python_module("${destination}"
"${submodule_name}" "${search_path}/${module}" "${location}/${module}")
endforeach ()
file(GLOB packages "${search_path}/${module}/*")
foreach (subpackage IN LISTS packages)
if (IS_DIRECTORY "${subpackage}" AND NOT subpackage STREQUAL "__pycache__")
get_filename_component(subpackage_name "${subpackage}" NAME)
superbuild_windows_install_python_module("${destination}"
"${subpackage_name}" "${search_path}/${module}" "${location}/${module}")
file(GLOB contents RELATIVE "${search_path}/${module}" "${search_path}/${module}/*")
foreach (item_name IN LISTS contents)
set(item_path "${search_path}/${module}/${item_name}")
if (IS_DIRECTORY "${item_path}")
if (NOT item_name STREQUAL "__pycache__")
superbuild_windows_install_python_module("${destination}"
"${item_name}" "${search_path}/${module}" "${location}/${module}")
endif()
else()
# not a directory, check if it's a Python module or arbitrary artifact
# file.
if (item_name MATCHES "\\.(py|pyd)$")
# it's a Python module; install it by a recursive call.
string(REGEX REPLACE "\\.(py|pyd)$" "" item_name "${item_name}")
superbuild_windows_install_python_module("${destination}"
"${item_name}" "${search_path}/${module}" "${location}/${module}")
else()
# an artifact file; install it.
file(INSTALL
FILES "${search_path}/${module}/${item_name}"
DESTINATION "${destination}/${location}/${module}")
endif()
endif ()
endforeach ()
endforeach()
endif ()
endforeach ()
endfunction ()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment