diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8ec7b4cc..56b0469f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -99,6 +99,7 @@ cleanup_win: - pwd - ls - docker info + - export PYTHONPATH=/opt/netgen/`python3 -c "import os.path, sysconfig;print(os.path.relpath(sysconfig.get_path('platlib'), sysconfig.get_path('data')))"` variables: UBUNTU_VERSION: "22.04" @@ -112,6 +113,7 @@ build_ubuntu_debug: docker run --cidfile netgen_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id -e CCACHE_DIR=/ccache + -e PYTHONPATH=$PYTHONPATH -v /mnt/ccache:/ccache netgen_${CI_PIPELINE_ID}:${UBUNTU_VERSION} bash /root/src/netgen/tests/build_debug.sh @@ -128,6 +130,7 @@ build_ubuntu_mpi: docker run>- --cidfile netgen_mpi_${CI_PIPELINE_ID}_${UBUNTU_VERSION}.id>- -e CCACHE_DIR=/ccache + -e PYTHONPATH=$PYTHONPATH -e RUN_SLOW_TESTS=${RUN_SLOW_TESTS} -v /mnt/ccache:/ccache netgen_mpi_${CI_PIPELINE_ID}:${UBUNTU_VERSION} @@ -141,8 +144,7 @@ test_ubuntu_debug: script: - >- docker run - -e NETGENDIR=/opt/netgen/bin - -e PYTHONPATH=/opt/netgen/lib/python3/dist-packages + -e PYTHONPATH=$PYTHONPATH netgen_${CI_PIPELINE_ID}_installed:${UBUNTU_VERSION} bash -c 'cd /root/build/netgen && make test_netgen ARGS="-V --output-on-failure"' needs: ["build_ubuntu_debug"] @@ -154,8 +156,7 @@ test_ubuntu_mpi: - >- docker run -e RUN_SLOW_TESTS=${RUN_SLOW_TESTS} - -e NETGENDIR=/opt/netgen/bin - -e PYTHONPATH=/opt/netgen/lib/python3/dist-packages + -e PYTHONPATH=$PYTHONPATH netgen_mpi_${CI_PIPELINE_ID}_installed:${UBUNTU_VERSION} bash -c 'cd /root/build/netgen && make test_netgen ARGS="-V --output-on-failure"' needs: ["build_ubuntu_mpi"] @@ -168,7 +169,7 @@ test_build_ngsolve: - >- docker run -e NETGENDIR=/opt/netgen/bin - -e PYTHONPATH=/opt/netgen/lib/python3/dist-packages + -e PYTHONPATH=$PYTHONPATH -e MKLROOT=/opt/intel/mkl -v /opt/intel:/opt/intel -e CCACHE_DIR=/ccache @@ -215,7 +216,7 @@ cleanup_ubuntu: - export SRC_DIR=$ROOT_DIR/src - export BUILD_DIR=$ROOT_DIR/build - export CMAKE_INSTALL_PREFIX=/tmp/$CI_PIPELINE_ID/install/Netgen.app - - export PYTHONPATH=$CMAKE_INSTALL_PREFIX/Contents/Resources/`python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1,0,''))"`:. + - export PYTHONPATH=$CMAKE_INSTALL_PREFIX/Contents/Resources/`python3 -c "import os.path, sysconfig;print(os.path.relpath(sysconfig.get_path('platlib'), sysconfig.get_path('data')))"`:. - export PATH=$CMAKE_INSTALL_PREFIX/Contents/MacOS:$PATH build_mac: diff --git a/CMakeLists.txt b/CMakeLists.txt index ddea54cf..4b0a57c0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -93,7 +93,7 @@ if(USE_PYTHON) endif() if(NOT CMAKE_CROSSCOMPILING) - execute_process(COMMAND ${Python3_EXECUTABLE} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1,0,''))" OUTPUT_VARIABLE PYTHON_PACKAGES_INSTALL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND ${Python3_EXECUTABLE} -c "import os.path, sysconfig;print(os.path.relpath(sysconfig.get_path('platlib'), sysconfig.get_path('data')))" OUTPUT_VARIABLE PYTHON_PACKAGES_INSTALL_DIR OUTPUT_STRIP_TRAILING_WHITESPACE) file(TO_CMAKE_PATH ${PYTHON_PACKAGES_INSTALL_DIR} PYTHON_PACKAGES_INSTALL_DIR) endif(NOT CMAKE_CROSSCOMPILING) endif(USE_PYTHON) diff --git a/setup.py b/setup.py index 3d569574..8d16161c 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,12 @@ import glob -import os +import os.path import sys import pathlib +import sysconfig from skbuild import setup import skbuild.cmaker from subprocess import check_output -from distutils.sysconfig import get_python_lib; setup_requires = [] @@ -35,7 +35,7 @@ if len(version)>1: else: version = version[0] -py_install_dir = get_python_lib(1,0,'').replace('\\','/') +py_install_dir = os.path.relpath(sysconfig.get_path('platlib'), sysconfig.get_path('data')).replace('\\','/') name = "netgen-mesher" arch = None