[python] Use dist-packages if is used for Python's sitepackages
Instead of checking whether this is Debian system we query the sitepackages path from Python. If it matches dist-packages then we use dist-packages if we install below /usr, otherwise site-packages is used.
This commit is contained in:
parent
06ff1db977
commit
bcf1ba0ba9
@ -334,9 +334,13 @@ install(FILES cmake/OPM-CMake.md
|
|||||||
install(FILES etc/opm_bash_completion.sh.in DESTINATION share/opm/etc)
|
install(FILES etc/opm_bash_completion.sh.in DESTINATION share/opm/etc)
|
||||||
|
|
||||||
if (OPM_ENABLE_PYTHON)
|
if (OPM_ENABLE_PYTHON)
|
||||||
|
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import site, sys; sys.stdout.write(site.getsitepackages()[-1]);" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES_PATH)
|
||||||
# -------------------------------------------------------------------------
|
# -------------------------------------------------------------------------
|
||||||
# 1: Wrap C++ functionality in Python
|
# 1: Wrap C++ functionality in Python
|
||||||
if (EXISTS "/etc/debian_version")
|
if (PYTHON_SITE_PACKAGES_PATH MATCHES ".*/dist-packages/?" AND
|
||||||
|
CMAKE_INSTALL_PREFIX MATCHES "^/usr.*")
|
||||||
|
# dist-packages is only used if we install below /usr and python's site packages
|
||||||
|
# path matches dist-packages
|
||||||
set(PYTHON_PACKAGE_PATH "dist-packages")
|
set(PYTHON_PACKAGE_PATH "dist-packages")
|
||||||
else()
|
else()
|
||||||
set(PYTHON_PACKAGE_PATH "site-packages")
|
set(PYTHON_PACKAGE_PATH "site-packages")
|
||||||
|
@ -226,7 +226,7 @@ function build_module_full {
|
|||||||
PY_MINOR=`python3 --version | awk -F ' ' '{print $2}' | awk -F '.' '{print $2}'`
|
PY_MINOR=`python3 --version | awk -F ' ' '{print $2}' | awk -F '.' '{print $2}'`
|
||||||
for configuration in ${!configurations[@]}
|
for configuration in ${!configurations[@]}
|
||||||
do
|
do
|
||||||
export PYTHONPATH="$WORKSPACE/$configuration/install/lib/python$PY_MAJOR.$PY_MINOR/dist-packages"
|
export PYTHONPATH="$WORKSPACE/$configuration/install/lib/python$PY_MAJOR.$PY_MINOR/site-packages"
|
||||||
|
|
||||||
# Build upstream modules
|
# Build upstream modules
|
||||||
build_upstreams
|
build_upstreams
|
||||||
|
Loading…
Reference in New Issue
Block a user