Make Python opm package a namespace package
Convert the Python opm package from a regular package to a namespace package such that opm-simulators can contribute to the package from a different filesystem path. In this way, the two packages opm.simulators and opm.io (for example) can have a different parent filesystem path.
This commit is contained in:
parent
02167f2c2f
commit
046736e45d
@ -184,6 +184,8 @@ if (OPM_ENABLE_PYTHON)
|
||||
endif()
|
||||
set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
|
||||
set(Python3_LIBRARIES ${PYTHON_LIBRARIES})
|
||||
set(Python3_VERSION "${PYTHON_VERSION_STRING}"})
|
||||
set(Python3_VERSION_MINOR ${PYTHON_VERSION_MINOR})
|
||||
else()
|
||||
# Be backwards compatible.
|
||||
if(PYTHON_EXECUTABLE AND NOT Python3_EXECUTABLE)
|
||||
@ -210,6 +212,10 @@ if (OPM_ENABLE_PYTHON)
|
||||
"Either use \"apt-get install python3-setuptools\" (on Debian/Ubuntu) "
|
||||
"or \"pip install setuptools\"")
|
||||
endif()
|
||||
if(Python3_VERSION_MINOR LESS 3)
|
||||
# Python native namespace packages requires python >= 3.3
|
||||
message(SEND_ERROR "OPM requires python >= 3.3 but only version ${Python3_VERSION} was found")
|
||||
endif()
|
||||
|
||||
# Compatibility settings for PythonInterp and PythonLibs
|
||||
# used e.g. in FindCwrap, pybind11
|
||||
|
@ -1,15 +0,0 @@
|
||||
# When using opm-simulators in combination with opm-common, the
|
||||
# opm-simulators pybind11 module is placed in a package opm2, i.e. opm2.simulators.
|
||||
# This is done to avoid conflict with the opm-common package prefix opm.
|
||||
# The following is hack to avoid having to write
|
||||
#
|
||||
# from opm2.simulators import BlackOilSimulator
|
||||
# from opm.io.parser import Parser
|
||||
# #....
|
||||
#
|
||||
# when it would be more natural to use the "opm" prefix instead of "opm2"
|
||||
# to import the BlackOilSimulator also. It assumes that PYTHONPATH includes
|
||||
# the install directory for the pybind11 python module for opm2.simulators
|
||||
|
||||
from opm2.simulators import BlackOilSimulator
|
||||
|
Loading…
Reference in New Issue
Block a user