Install PYTHON Modules when running jenkins

This commit is contained in:
Joakim Hove
2019-10-06 17:08:05 +02:00
parent 59b73a0667
commit 7dc77d1ca3
3 changed files with 9 additions and 6 deletions

View File

@@ -273,13 +273,14 @@ if (OPM_ENABLE_PYTHON)
# preferred to use standard setup.py install, but the setup.py based solution
# refuses to install to a location which the current python executable can not
# load from, and the use of eggs in the setup.py based installation makes
# debugging and fauly seeking very difficult.
# debugging quite difficult.
#
# Since the installation of Python code is nonstandard it is protected by an
# extra cmake switch, OPM_INSTALL_PYTHON. If you prefer you can still use the
# setup.py based installation method.
# extra cmake switch, OPM_INSTALL_PYTHON. If you prefer you can still invoke
# setup.py install manually - optionally with the generated script
# setup-install.sh - and completely bypass cmake in the installation phase.
if (OPM_INSTALL_PYTHON)
install( CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} python/python/opm ${CMAKE_INSTALL_PREFIX})")
install( CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python/install.py ${CMAKE_BINARY_DIR}/python/python/opm ${CMAKE_INSTALL_PREFIX}/${PYTHON_INSTALL_PREFIX})")
endif()
add_test(NAME python_tests

View File

@@ -4,7 +4,7 @@ declare -A configurations
declare -A EXTRA_MODULE_FLAGS
EXTRA_MODULE_FLAGS[opm-simulators]="-DBUILD_EBOS_EXTENSIONS=ON -DBUILD_EBOS_DEBUG_EXTENSIONS=ON -DBUILD_FLOW_VARIANTS=ON"
EXTRA_MODULE_FLAGS[opm-common]="-DOPM_ENABLE_PYTHON=ON -DOPM_ENABLE_EMBEDDED_PYTHON=ON"
EXTRA_MODULE_FLAGS[opm-common]="-DOPM_ENABLE_PYTHON=ON -DOPM_ENABLE_EMBEDDED_PYTHON=ON -DOPM_INSTALL_PYTHON=ON"
EXTRA_MODULE_FLAGS[libecl]="-DCMAKE_POSITION_INDEPENDENT_CODE=1"
# Parse revisions from trigger comment and setup arrays

View File

@@ -4,7 +4,7 @@ import shutil
import compileall
src_root = sys.argv[1]
target_prefix = os.path.join(sys.argv[2], "lib", "python{}.{}".format(sys.version_info.major, sys.version_info.minor),"site-packages")
target_prefix = sys.argv[2]
if not os.path.isdir(src_root):
@@ -14,6 +14,7 @@ path_offset = len(os.path.dirname(src_root))
for path,_ ,fnames in os.walk(src_root):
target_path = os.path.join(target_prefix, path[path_offset+1:])
if not os.path.isdir(target_path):
print("-- Installing: {}".format(target_path))
os.makedirs(target_path)
for f in fnames:
@@ -24,6 +25,7 @@ for path,_ ,fnames in os.walk(src_root):
src_file = os.path.join(path, f)
target_file = os.path.join(target_path, f)
shutil.copy(src_file, target_file)
print("-- Installing: {}".format(target_file))
target_root = os.path.join(target_prefix, os.path.basename(src_root))
compileall.compile_dir(target_root)