From 8c79449c9db4c22fb6df60c6b6be1657d6af3ba8 Mon Sep 17 00:00:00 2001 From: Tom Schoonjans Date: Sun, 24 Dec 2023 11:01:44 +0100 Subject: [PATCH] Resurrect CI --- .github/workflows/ci.yml | 213 +++++++----------- configure.ac | 2 +- example/Makefile.am | 5 +- example/xrlexample13.py | 5 +- example/xrlexample5.py | 5 +- java/gradle/wrapper/gradle-wrapper.properties | 2 +- python/tests/Makefile.am | 2 +- python/tests/meson.build | 3 +- python/tests/test-atomiclevelwidth.py | 5 + python/tests/test-atomicweight.py | 5 + python/tests/test-auger.py | 5 + python/tests/test-compoundparser.py | 5 + python/tests/test-comptonprofiles.py | 5 + python/tests/test-crystal_diffraction.py | 5 + python/tests/test-nist-compounds.py | 5 + python/tests/test-numpy.py | 6 + python/tests/test-radionuclides.py | 5 + 17 files changed, 145 insertions(+), 138 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad2595f2..3460a1b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,12 +17,12 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest] - python-version: ['3.8', '3.9', '3.10'] + python-version: ['3.9', '3.10', '3.11', '3.12'] name: Pip install with Python ${{ matrix.python-version }} on ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v3 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install xraylib with pip @@ -38,28 +38,28 @@ jobs: timeout-minutes: 60 runs-on: windows-latest strategy: + fail-fast: false matrix: - python-version: ['3.8', '3.9', '3.10'] + python-version: ['3.9', '3.10', '3.11', '3.12'] compiler: - cl - clang-cl name: Visual Studio with ${{matrix.compiler}} and Python ${{ matrix.python-version }} steps: - - uses: actions/checkout@v3 - - uses: conda-incubator/setup-miniconda@v2.1.1 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 with: - auto-update-conda: true - channels: conda-forge python-version: ${{ matrix.python-version }} - name: Install meson, ninja, numpy and cython run: | - conda install -q -y meson ninja numpy cython swig - - uses: ilammy/msvc-dev-cmd@v1.12.0 + python -m pip install -U numpy pip + python -m pip install meson ninja cython + - uses: ilammy/msvc-dev-cmd@v1 - name: Build with meson run: | meson setup meson-build --buildtype=release -Dpython=python -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled meson compile -C meson-build - meson test -C meson-build + meson test -C meson-build || (cat meson-build\meson-logs\testlog.txt) # ninja -v -C meson-build dist env: CC: ${{ matrix.compiler }} @@ -110,6 +110,7 @@ jobs: mingw-w64-x86_64-cython mingw-w64-x86_64-python3-numpy mingw-w64-x86_64-meson + mingw-w64-x86_64-swig automake autoconf libtool @@ -117,14 +118,14 @@ jobs: patch wget tar - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Primary build and test with Meson if: matrix.buildsystem == 'meson' run: | set -ex meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled meson compile -C meson-build - meson test -C meson-build + meson test -C meson-build || (cat meson-build/meson-logs/testlog.txt && exit 1) set +ex env: @@ -136,34 +137,39 @@ jobs: set -ex autoreconf -fi - ./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic" || (cat config.log && exit 1) - make - make check - make windows - make distclean - ./configure --disable-all-bindings --disable-shared --enable-static - make + make -j$(nproc) make check make distclean ./configure --disable-python --disable-python-numpy --enable-fortran2003 --disable-ruby - make + make -j$(nproc) make check make distclean ./configure --enable-python --enable-python-numpy PYTHON=python3 --disable-ruby - make + make -j$(nproc) + make check || (cat python/tests/test-suite.log && exit 1) + make distclean + + ./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic" || (cat config.log && exit 1) + make -j$(nproc) make check + make windows set +ex env: CC: ${{matrix.cc}} CXX: ${{matrix.cxx}} - CYTHON: cython - PYTHON: python3 + - name: Upload Windows installer + if: matrix.buildsystem == 'autotools' && matrix.cc == 'gcc' + uses: actions/upload-artifact@v4 + with: + name: windows-installer + path: windows\xraylib-*-win64.exe + retention-days: 1 - macos: + macos: timeout-minutes: 60 runs-on: macos-latest strategy: @@ -173,22 +179,21 @@ jobs: - meson compiler: - llvm - - gcc + - gcc@13 include: - ldflags: "" - # at least some versions of clang cannot compile php bindings - compiler: llvm cc: /usr/local/opt/llvm/bin/clang cxx: /usr/local/opt/llvm/bin/clang++ ldflags: -L/usr/local/opt/llvm/lib enable_ruby: enable - - compiler: gcc - cc: gcc-11 - cxx: g++-11 + - compiler: gcc@13 + cc: gcc-13 + cxx: g++-13 # -fdeclspec is only supported by llvm's clang! enable_ruby: disable steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Homebrew dependencies run: | set -ex @@ -196,14 +201,17 @@ jobs: brew uninstall -f bazel bazelisk mongodb-community brew update brew upgrade - brew install git autoconf automake libtool pkg-config python ${{ matrix.compiler }} swig ruby fpc lua perl php@7.4 bash numpy meson ninja + brew install git autoconf automake libtool pkg-config ${{ matrix.compiler }} swig ruby fpc lua bash numpy meson ninja + brew link --overwrite python + brew unlink python && brew link --overwrite python + ls -l /usr/local/bin/python3 set +ex env: HOMEBREW_CURL_RETRIES: 5 - name: Install Cython run: | - /usr/local/bin/pip3 install Cython + /usr/local/bin/python3 -m pip install Cython - name: Primary Build and test with Meson if: matrix.buildsystem == 'meson' @@ -229,7 +237,7 @@ jobs: cd ${TARBALL%.tar.xz} autoreconf -fi ./configure --enable-python SHELL=${SHELL} PYTHON=/usr/local/bin/python3 - make + make -j$(nproc) make check set +ex env: @@ -243,26 +251,26 @@ jobs: autoreconf -fi # Build without python - ./configure --disable-python --disable-python-numpy --enable-perl --enable-lua --enable-pascal --disable-java --enable-php --${{matrix.enable_ruby}}-ruby PHP=/usr/local/opt/php@7.4/bin/php PHP_CONFIG=/usr/local/opt/php@7.4/bin/php-config SHELL=${SHELL} RUBY=/usr/local/opt/ruby/bin/ruby - make - make check || (cat perl/tests/test-suite.log && exit 1) + ./configure --disable-python --disable-python-numpy --disable-perl --enable-lua --enable-pascal --disable-java --disable-php --${{matrix.enable_ruby}}-ruby SHELL=${SHELL} RUBY=/usr/local/opt/ruby/bin/ruby + make -j$(nproc) + make check make distclean # Build without bindings in ANSI-C ./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic" SHELL=${SHELL} - make + make -j$(nproc) make check make distclean # Build with Python3 bindings ./configure --disable-ruby --disable-perl --disable-lua --enable-python-numpy --enable-python PYTHON=${XRL_PYTHON3} SHELL=${SHELL} - make + make -j$(nproc) make check make distclean # Build static library ./configure --disable-all-bindings --disable-shared --enable-static SHELL=${SHELL} - make + make -j$(nproc) make check make distclean @@ -284,13 +292,14 @@ jobs: TARBALL=$(ls *.tar.gz) tar xfz $TARBALL cd ${TARBALL%.tar.gz} - meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled + meson setup meson-build -Dpython-bindings=enabled -Dpython-numpy-bindings=enabled -Dpython=${XRL_PYTHON3} meson compile -C meson-build set +ex env: CC: ${{matrix.cc}} CXX: ${{matrix.cxx}} LDFLAGS: ${{matrix.ldflags}} + XRL_PYTHON3: /usr/local/bin/python3 linux: timeout-minutes: 60 @@ -298,77 +307,38 @@ jobs: fail-fast: false matrix: image: - - ubuntu:focal - - ubuntu:devel - - debian:bullseye - - debian:sid - - centos:7 + - ubuntu:jammy + - debian:bookworm - rockylinux:8 + - rockylinux:9 - fedora:latest - - fedora:rawhide cc: - clang - gcc buildsystem: - autotools - meson - exclude: - - image: ubuntu:focal - buildsystem: meson - - image: centos:7 - buildsystem: meson - - image: rockylinux:8 - buildsystem: meson + # exclude: + # - image: rockylinux:8 + # buildsystem: meson include: - # at least some versions of clang cannot compile php bindings - - cython: cython - perl: enable - fpc: enable - fortran: enable - python: enable - - cc: clang - cxx: clang++ - php: disable - cc: gcc cxx: g++ - php: enable - cc: clang - image: rockylinux:8 - perl: disable - libs: -stdlib=libstdc++ - fortran: disable - clang_cflags: -Qunused-arguments - python: disable - - image: centos:7 - fpc: disable - cython: cython3.6 - - image: centos:7 - cc: clang - libs: -stdlib=libstdc++ - fortran: disable - clang_cflags: -Qunused-arguments - python: disable + cxx: clang++ + - fpc: enable + fortran: enable + python: enable + # - cc: clang + # image: rockylinux:8 + # libs: -stdlib=libstdc++ + # fortran: disable + # clang_cflags: -Qunused-arguments + # python: enable - cc: clang image: fedora:latest - perl: disable python: disable clang_cflags: -Qunused-arguments - - cc: clang - image: fedora:rawhide - perl: disable - python: disable - clang_cflags: -Qunused-arguments - - image: ubuntu:focal - lua: /usr/bin/lua5.3 - - image: ubuntu:devel - lua: /usr/bin/lua5.3 - - image: debian:bullseye - lua: /usr/bin/lua5.3 - - image: debian:sid - lua: /usr/bin/lua5.3 - php: disable # comes with PHP 8, unsupported by SWIG - - image: centos:7 - lua: /usr/bin/lua - image: rockylinux:8 lua: /usr/bin/lua - image: fedora:latest @@ -389,19 +359,18 @@ jobs: env: DEBIAN_FRONTEND: noninteractive - name: Install Git - if: startsWith(matrix.image, 'centos') || startsWith(matrix.image, 'fedora') + if: startsWith(matrix.image, 'rockylinux') || startsWith(matrix.image, 'fedora') run: | set -ex yum install -y git set +ex - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install ubuntu dependencies if: startsWith(matrix.image, 'ubuntu') || startsWith(matrix.image, 'debian') run: | set -ex apt-get --yes --force-yes update - apt-get --yes --force-yes install autoconf automake libtool python3-pip python3-all-dev python3-numpy fpc gfortran gcc php-dev swig libperl-dev perl lua5.3 liblua5.3-dev ruby-dev default-jdk clang - pip3 install Cython + apt-get --yes --force-yes install autoconf automake libtool python3-pip python3-all-dev python3-numpy cython3 fpc gfortran gcc swig lua5.3 liblua5.3-dev ruby-dev default-jdk clang set +ex env: DEBIAN_FRONTEND: noninteractive @@ -413,27 +382,28 @@ jobs: set +ex env: DEBIAN_FRONTEND: noninteractive - - name: Activate CentOS 8 PowerTools and EPEL repo + - name: Activate RockyLinux 8 PowerTools and EPEL repo if: matrix.image == 'rockylinux:8' run: | set -ex - yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm dnf install -y 'dnf-command(config-manager)' dnf config-manager --set-enabled powertools + dnf install -y epel-release set +ex - - name: Activate CentOS 7 EPEL repo - if: matrix.image == 'centos:7' + - name: Activate RockyLinux 9 PowerTools and EPEL repo + if: matrix.image == 'rockylinux:9' run: | set -ex - yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm - yum install -y python36-Cython # this one needs to be brought in separately for CentOS 7 + dnf install -y 'dnf-command(config-manager)' + dnf config-manager --set-enabled crb + dnf install -y epel-release set +ex - name: Install RHEL dependencies if: startsWith(matrix.image, 'centos') || startsWith(matrix.image, 'fedora') || startsWith(matrix.image, 'rockylinux') run: | set -ex yum update -y - yum install -y make autoconf automake libtool python3-Cython python3-setuptools python3-devel python3-numpy fpc gcc-gfortran gcc php-devel swig perl-devel perl perl-Test-Simple lua lua-devel ruby ruby-devel rubygem-minitest rubygem-test-unit java-1.8.0-openjdk java-1.8.0-openjdk-devel clang libstdc++-devel gcc-c++ which rpm-build rpmdevtools lua-srpm-macros perl-macros + yum install -y make autoconf automake libtool python3-setuptools python3-devel python3-numpy python3-Cython fpc gcc-gfortran gcc swig lua lua-devel ruby ruby-devel rubygem-minitest rubygem-test-unit java-1.8.0-openjdk java-1.8.0-openjdk-devel clang libstdc++-devel gcc-c++ which java -version which java javac -version @@ -456,57 +426,44 @@ jobs: meson dist -C meson-build set +ex env: - CYTHON: ${{matrix.cython}} CC: ${{matrix.cc}} CXX: ${{matrix.cxx}} - LIBS: ${{matrix.libs}} + # LIBS: ${{matrix.libs}} - name: Build and test with Autotools if: matrix.buildsystem == 'autotools' run: | set -ex autoreconf -fi # disable java for now - ./configure --disable-python --disable-python-numpy --${PERL_ENABLE}-perl --enable-lua --${FPC_ENABLE}-pascal --disable-java --${PHP_ENABLE}-php --enable-ruby --${FORTRAN_ENABLE}-fortran2003 || (cat config.log && exit 1) - make + ./configure --disable-python --disable-python-numpy --disable-perl --enable-lua --${FPC_ENABLE}-pascal --disable-java --disable-php --enable-ruby --${FORTRAN_ENABLE}-fortran2003 || (cat config.log && exit 1) + make -j$(nproc) make check || (cat example/xrlexample12.sh.log && exit 1) make distclean ./configure --disable-all-bindings CFLAGS="-std=c89 -pedantic $CFLAGS" - make + make -j$(nproc) make check make distclean ./configure --disable-ruby --disable-perl --disable-lua --disable-fortran2003 --${PYTHON_ENABLE}-python-numpy --${PYTHON_ENABLE}-python PYTHON=${XRL_PYTHON3} - make + make -j$(nproc) make check make distclean ./configure --disable-all-bindings --disable-shared --enable-static - make + make -j$(nproc) make check make distclean ./configure --disable-all-bindings make distcheck PYTHON=${XRL_PYTHON3} set +ex env: - CYTHON: ${{matrix.cython}} CC: ${{matrix.cc}} CXX: ${{matrix.cxx}} CXXFLAGS: -std=c++11 - LIBS: ${{matrix.libs}} + # LIBS: ${{matrix.libs}} XRL_PYTHON3: /usr/bin/python3 LUA: ${{matrix.lua}} JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8 - PHP_ENABLE: ${{matrix.php}} PYTHON_ENABLE: ${{matrix.python}} FORTRAN_ENABLE: ${{matrix.fortran}} - PERL_ENABLE: ${{matrix.perl}} FPC_ENABLE: ${{matrix.fpc}} - DISTCHECK_CONFIGURE_FLAGS: --${{matrix.fpc}}-pascal --enable-java --${{matrix.perl}}-perl --enable-lua --${{matrix.python}}-python --${{matrix.python}}-python-numpy --${{matrix.php}}-php --enable-ruby --${{matrix.fortran}}-fortran2003 + DISTCHECK_CONFIGURE_FLAGS: --${{matrix.fpc}}-pascal --enable-java --disable-perl --enable-lua --${{matrix.python}}-python --${{matrix.python}}-python-numpy --disable-php --enable-ruby --${{matrix.fortran}}-fortran2003 CFLAGS: ${{matrix.clang_cflags}} - - name: Test rpm-build - if: matrix.buildsystem == 'autotools' && (startsWith(matrix.image, 'centos') || startsWith(matrix.image, 'fedora') || startswith(matrix.image, 'rockylinux')) - run: | - set -ex - rpmdev-setuptree - cp xraylib-*.tar.gz ~/rpmbuild/SOURCES - cp xraylib.spec ~/rpmbuild/SPECS - rpmbuild -ba ~/rpmbuild/SPECS/xraylib.spec - set +ex diff --git a/configure.ac b/configure.ac index 46146344..75817f9f 100644 --- a/configure.ac +++ b/configure.ac @@ -650,7 +650,7 @@ if test "x$enable_python_np" != xno && test "x$DISABLE_BINDINGS" = xno ; then fi if test "x$VALID_PYTHON_EXE" = xyes ; then #now check cython - AC_CHECK_PROGS(CYTHON, [cython-[$PYTHON_VERSION] cython],["nocython"]) + AC_CHECK_PROGS(CYTHON, [cython-[$PYTHON_VERSION] cython3 cython],["nocython"]) if test x$CYTHON != "xnocython" ; then VALID_PYTHON_NUMPY=yes AC_MSG_NOTICE([Building with Python-NumPy bindings]) diff --git a/example/Makefile.am b/example/Makefile.am index 284761fc..385cd8d2 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -100,7 +100,7 @@ xrlexample2.sh: ../perl/xraylib.la xrlexample2.pl #test the python bindings xrlexample5.sh: ../python/_xraylib.la xrlexample5.py @echo "Testing python bindings" - @echo "LD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" DYLD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" PATH=\"${top_builddir}/src/.libs\" PYTHONPATH=\"${top_builddir}/python:${top_builddir}/python/.libs\" $(PYTHON) ${top_srcdir}/example/xrlexample5.py" > xrlexample5.sh + @echo "EXTRA_DLL_SEARCH_PATHS=\"${abs_top_builddir}/src/.libs\" LD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" DYLD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" PATH=\"${top_builddir}/src/.libs\" PYTHONPATH=\"${top_builddir}/python:${top_builddir}/python/.libs\" $(PYTHON) ${top_srcdir}/example/xrlexample5.py" > xrlexample5.sh @chmod +x xrlexample5.sh #test the java bindings @@ -134,10 +134,9 @@ xrlexample12.sh: ../php/xraylib.la xrlexample12.php #test the numpy-python bindings xrlexample13.sh: ../python/xraylib_np.la xrlexample13.py @echo "Testing python-numpy bindings" - @echo "LD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" DYLD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" PATH=\"${top_builddir}/src/.libs\" PYTHONPATH=\"${top_builddir}/python:${top_builddir}/python/.libs\" $(PYTHON) ${top_srcdir}/example/xrlexample13.py" > xrlexample13.sh + @echo "EXTRA_DLL_SEARCH_PATHS=\"${abs_top_builddir}/src/.libs\" LD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" DYLD_LIBRARY_PATH=\"${top_builddir}/src/.libs\" PATH=\"${top_builddir}/src/.libs\" PYTHONPATH=\"${top_builddir}/python:${top_builddir}/python/.libs\" $(PYTHON) ${top_srcdir}/example/xrlexample13.py" > xrlexample13.sh @chmod +x xrlexample13.sh - #testing the Pascal-Delphi bindings xrlexample14.sh: ../pascal/xraylib.ppu xrlexample14.pas @echo "Testing Pascal bindings" diff --git a/example/xrlexample13.py b/example/xrlexample13.py index fd4bbf11..108aafc4 100644 --- a/example/xrlexample13.py +++ b/example/xrlexample13.py @@ -10,12 +10,15 @@ #THIS SOFTWARE IS PROVIDED BY Tom Schoonjans ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Tom Schoonjans BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +import os +if "EXTRA_DLL_SEARCH_PATHS" in os.environ and hasattr(os, "add_dll_directory"): + for path in os.environ["EXTRA_DLL_SEARCH_PATHS"].split(os.pathsep): + os.add_dll_directory(path) import numpy as np import xraylib_np as xrl_np import sys - if __name__ == '__main__' : xrl_np.XRayInit() print ("Example of python-numpy program using xraylib") diff --git a/example/xrlexample5.py b/example/xrlexample5.py index e2f91db5..196f9343 100644 --- a/example/xrlexample5.py +++ b/example/xrlexample5.py @@ -12,7 +12,10 @@ """Example of using various xraylib functionality in python.""" - +import os +if "EXTRA_DLL_SEARCH_PATHS" in os.environ and hasattr(os, "add_dll_directory"): + for path in os.environ["EXTRA_DLL_SEARCH_PATHS"].split(os.pathsep): + os.add_dll_directory(path) import xraylib import math import numpy as np diff --git a/java/gradle/wrapper/gradle-wrapper.properties b/java/gradle/wrapper/gradle-wrapper.properties index 442d9132..068cdb2d 100644 --- a/java/gradle/wrapper/gradle-wrapper.properties +++ b/java/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/python/tests/Makefile.am b/python/tests/Makefile.am index 857a8fef..94948173 100644 --- a/python/tests/Makefile.am +++ b/python/tests/Makefile.am @@ -3,7 +3,7 @@ NULL= TEST_EXTENSIONS = .py PY_LOG_COMPILER = $(PYTHON) AM_PY_LOG_FLAGS = -AM_TESTS_ENVIRONMENT = LD_LIBRARY_PATH='${top_builddir}/src/.libs' DYLD_LIBRARY_PATH='${top_builddir}/src/.libs' PATH='${top_builddir}/src/.libs' PYTHONPATH='${top_builddir}/python:${top_builddir}/python/.libs' ; export LD_LIBRARY_PATH DYLD_LIBRARY_PATH PATH PYTHONPATH ; +AM_TESTS_ENVIRONMENT = EXTRA_DLL_SEARCH_PATHS='${abs_top_builddir}/src/.libs' LD_LIBRARY_PATH='${top_builddir}/src/.libs' DYLD_LIBRARY_PATH='${top_builddir}/src/.libs' PATH='${top_builddir}/src/.libs' PYTHONPATH='${top_builddir}/python:${top_builddir}/python/.libs' ; export LD_LIBRARY_PATH DYLD_LIBRARY_PATH PATH PYTHONPATH EXTRA_DLL_SEARCH_PATHS ; if ENABLE_PYTHON dist_check_SCRIPTS = \ diff --git a/python/tests/meson.build b/python/tests/meson.build index 9435852e..261bd041 100644 --- a/python/tests/meson.build +++ b/python/tests/meson.build @@ -14,8 +14,7 @@ test_env = environment() test_env.prepend('PYTHONPATH', pydir) if host_system == 'windows' test_env.prepend('PATH', src_build_dir) - # see https://github.com/xhochy/python-feedstock/blob/6efc12d0479e958a138bfaf3d1eb6b47a10d5f68/recipe/patches/0014-Add-CondaEcosystemModifyDllSearchPath.patch - test_env.prepend('CONDA_DLL_SEARCH_MODIFICATION_ENABLE', '1') + test_env.append('EXTRA_DLL_SEARCH_PATHS', src_build_dir) endif foreach _test : tests diff --git a/python/tests/test-atomiclevelwidth.py b/python/tests/test-atomiclevelwidth.py index 09f520e9..dad33786 100644 --- a/python/tests/test-atomiclevelwidth.py +++ b/python/tests/test-atomiclevelwidth.py @@ -1,6 +1,11 @@ +import os +if "EXTRA_DLL_SEARCH_PATHS" in os.environ and hasattr(os, "add_dll_directory"): + for path in os.environ["EXTRA_DLL_SEARCH_PATHS"].split(os.pathsep): + os.add_dll_directory(path) import unittest import xraylib + class TestAtomicLevelWidth(unittest.TestCase): def test_Fe_K(self): width = xraylib.AtomicLevelWidth(26, xraylib.K_SHELL) diff --git a/python/tests/test-atomicweight.py b/python/tests/test-atomicweight.py index 69e427d8..a655a41a 100644 --- a/python/tests/test-atomicweight.py +++ b/python/tests/test-atomicweight.py @@ -1,6 +1,11 @@ +import os +if "EXTRA_DLL_SEARCH_PATHS" in os.environ and hasattr(os, "add_dll_directory"): + for path in os.environ["EXTRA_DLL_SEARCH_PATHS"].split(os.pathsep): + os.add_dll_directory(path) import unittest import xraylib + class TestAtomicWeight(unittest.TestCase): def test_Fe(self): weight = xraylib.AtomicWeight(26) diff --git a/python/tests/test-auger.py b/python/tests/test-auger.py index e4d72bcd..6be1c326 100644 --- a/python/tests/test-auger.py +++ b/python/tests/test-auger.py @@ -1,6 +1,11 @@ +import os +if "EXTRA_DLL_SEARCH_PATHS" in os.environ and hasattr(os, "add_dll_directory"): + for path in os.environ["EXTRA_DLL_SEARCH_PATHS"].split(os.pathsep): + os.add_dll_directory(path) import unittest import xraylib + class TestAugerRate(unittest.TestCase): def test_Pb_K_L3M5(self): rate = xraylib.AugerRate(82, xraylib.K_L3M5_AUGER) diff --git a/python/tests/test-compoundparser.py b/python/tests/test-compoundparser.py index 1d42cc44..a535439e 100644 --- a/python/tests/test-compoundparser.py +++ b/python/tests/test-compoundparser.py @@ -1,6 +1,11 @@ +import os +if "EXTRA_DLL_SEARCH_PATHS" in os.environ and hasattr(os, "add_dll_directory"): + for path in os.environ["EXTRA_DLL_SEARCH_PATHS"].split(os.pathsep): + os.add_dll_directory(path) import unittest import xraylib + class TestCompoundParser(unittest.TestCase): def test_good_compounds(self): self.assertIsInstance(xraylib.CompoundParser("C19H29COOH"), dict) diff --git a/python/tests/test-comptonprofiles.py b/python/tests/test-comptonprofiles.py index 54dd284a..54c19d8e 100644 --- a/python/tests/test-comptonprofiles.py +++ b/python/tests/test-comptonprofiles.py @@ -1,6 +1,11 @@ +import os +if "EXTRA_DLL_SEARCH_PATHS" in os.environ and hasattr(os, "add_dll_directory"): + for path in os.environ["EXTRA_DLL_SEARCH_PATHS"].split(os.pathsep): + os.add_dll_directory(path) import unittest import xraylib + class TestComptonProfiles(unittest.TestCase): def test_pz_0(self): profile = xraylib.ComptonProfile(26, 0.0) diff --git a/python/tests/test-crystal_diffraction.py b/python/tests/test-crystal_diffraction.py index 029e0bfc..dd225055 100644 --- a/python/tests/test-crystal_diffraction.py +++ b/python/tests/test-crystal_diffraction.py @@ -1,7 +1,12 @@ +import os +if "EXTRA_DLL_SEARCH_PATHS" in os.environ and hasattr(os, "add_dll_directory"): + for path in os.environ["EXTRA_DLL_SEARCH_PATHS"].split(os.pathsep): + os.add_dll_directory(path) import unittest import xraylib import math + class TestCrystalDiffraction(unittest.TestCase): def test_crystal_diffraction(self): crystals_list = xraylib.Crystal_GetCrystalsList() diff --git a/python/tests/test-nist-compounds.py b/python/tests/test-nist-compounds.py index 5cc41a3a..896f10fe 100644 --- a/python/tests/test-nist-compounds.py +++ b/python/tests/test-nist-compounds.py @@ -1,6 +1,11 @@ +import os +if "EXTRA_DLL_SEARCH_PATHS" in os.environ and hasattr(os, "add_dll_directory"): + for path in os.environ["EXTRA_DLL_SEARCH_PATHS"].split(os.pathsep): + os.add_dll_directory(path) import unittest import xraylib + class TestNISTCompounds(unittest.TestCase): def test_good(self): list = xraylib.GetCompoundDataNISTList() diff --git a/python/tests/test-numpy.py b/python/tests/test-numpy.py index a8ac574a..d201f178 100644 --- a/python/tests/test-numpy.py +++ b/python/tests/test-numpy.py @@ -1,7 +1,13 @@ +import os +if "EXTRA_DLL_SEARCH_PATHS" in os.environ and hasattr(os, "add_dll_directory"): + for path in os.environ["EXTRA_DLL_SEARCH_PATHS"].split(os.pathsep): + os.add_dll_directory(path) import unittest import xraylib import numpy as np + + class TestNumpy(unittest.TestCase): def _test_np(self, dtype): for Z in np.arange(10, 20, dtype=dtype): diff --git a/python/tests/test-radionuclides.py b/python/tests/test-radionuclides.py index bffa8d87..98b2fe2d 100644 --- a/python/tests/test-radionuclides.py +++ b/python/tests/test-radionuclides.py @@ -1,6 +1,11 @@ +import os +if "EXTRA_DLL_SEARCH_PATHS" in os.environ and hasattr(os, "add_dll_directory"): + for path in os.environ["EXTRA_DLL_SEARCH_PATHS"].split(os.pathsep): + os.add_dll_directory(path) import unittest import xraylib + class TestRadionuclides(unittest.TestCase): def test_good(self): list = xraylib.GetRadioNuclideDataList()