mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-14 20:13:25 -06:00
Use CMake's find_file to find install.py for Python installation.
This seems to be a more stable approach as it does not produce ``` /usr/bin/python3.9: can't open file '/home/mblatt/src/dune/opm-2.9/opm-common//install.py': [Errno 2] No such file or directory ``` for rebuilds after failed attempts.
This commit is contained in:
parent
d6232f03ec
commit
02666a6677
@ -56,22 +56,20 @@ if(OPM_ENABLE_PYTHON_TESTS)
|
|||||||
-m unittest test/test_schedule.py)
|
-m unittest test/test_schedule.py)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(_opm_common_python_script_dir "${opm-common_DIR}/python")
|
find_file(PYTHON_INSTALL_PY install.py
|
||||||
if (NOT EXISTS "${_opm_common_python_script_dir}/install.py" )
|
PATHS ${opm-common_DIR} ${opm-common_PYTHON_COMMON_DIR}
|
||||||
# if the install.py script does not exist, assume that we are building against an installed opm-common
|
PATH_SUFFIXES python NO_DEFAULT_PATH REQUIRED)
|
||||||
set(_opm_common_python_script_dir "${opm-common_PYTHON_COMMON_DIR}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# NOTE: instead of using file( COPY ...) which copies the files at configure time (not at build time)
|
# NOTE: instead of using file( COPY ...) which copies the files at configure time (not at build time)
|
||||||
# we should add copying of the files at build time such that running "make" or "make all" will
|
# we should add copying of the files at build time such that running "make" or "make all" will
|
||||||
# update the files if they have been modified. We use the install.py script in opm-common, see also
|
# update the files if they have been modified. We use the install.py script in opm-common, see also
|
||||||
# CMakeLists.txt in opm-common
|
# CMakeLists.txt in opm-common
|
||||||
add_custom_target(copy_python ALL
|
add_custom_target(copy_python ALL
|
||||||
COMMAND ${PYTHON_EXECUTABLE} "${_opm_common_python_script_dir}/install.py"
|
COMMAND ${PYTHON_EXECUTABLE} "${PYTHON_INSTALL_PY}"
|
||||||
${PROJECT_SOURCE_DIR}/python/opm ${PROJECT_BINARY_DIR}/python 0
|
${PROJECT_SOURCE_DIR}/python/opm ${PROJECT_BINARY_DIR}/python 0
|
||||||
COMMAND ${PYTHON_EXECUTABLE} "${_opm_common_python_script_dir}/install.py"
|
COMMAND ${PYTHON_EXECUTABLE} "${PYTHON_INSTALL_PY}"
|
||||||
${PROJECT_SOURCE_DIR}/python/test ${PROJECT_BINARY_DIR}/python 0
|
${PROJECT_SOURCE_DIR}/python/test ${PROJECT_BINARY_DIR}/python 0
|
||||||
COMMAND ${PYTHON_EXECUTABLE} "${_opm_common_python_script_dir}/install.py"
|
COMMAND ${PYTHON_EXECUTABLE} "${PYTHON_INSTALL_PY}"
|
||||||
${PROJECT_SOURCE_DIR}/python/test_data ${PROJECT_BINARY_DIR}/python 0
|
${PROJECT_SOURCE_DIR}/python/test_data ${PROJECT_BINARY_DIR}/python 0
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -85,7 +83,7 @@ if (OPM_INSTALL_PYTHON)
|
|||||||
install(
|
install(
|
||||||
CODE "execute_process(
|
CODE "execute_process(
|
||||||
COMMAND ${PYTHON_EXECUTABLE}
|
COMMAND ${PYTHON_EXECUTABLE}
|
||||||
${_opm_common_python_script_dir}/install.py
|
${PYTHON_INSTALL_PY}
|
||||||
${PROJECT_BINARY_DIR}/python/opm
|
${PROJECT_BINARY_DIR}/python/opm
|
||||||
${DEST_PREFIX}${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX} 1)")
|
${DEST_PREFIX}${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX} 1)")
|
||||||
endif()
|
endif()
|
||||||
|
Loading…
Reference in New Issue
Block a user