From 2ba8c6e16149668ef1ced238b08d9c27d75298fb Mon Sep 17 00:00:00 2001 From: Jerome Kieffer Date: Fri, 17 May 2024 15:05:35 +0200 Subject: [PATCH 1/2] read also environment variable --- meson.build | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/meson.build b/meson.build index a0fcf3df5..0c96c121d 100644 --- a/meson.build +++ b/meson.build @@ -7,22 +7,28 @@ project('pyFAI', default_options: ['buildtype=plain', ], ) +py_mod = import('python') +py = py_mod.find_installation() +os = import('fs') # Seek the backend if meson.backend() != 'ninja' error('Ninja backend required') endif -# Read configuration files to disable OpenMP: -# 'PYFAI_WITH_OPENMP' file should contain 'False' -os = import('fs') +# How to disable OpenMP: +# The 'PYFAI_WITH_OPENMP' file should contain 'False' if os.is_file('PYFAI_WITH_OPENMP') openmp_var = os.read('PYFAI_WITH_OPENMP').strip() else - openmp_var = '' + res = run_command(py, '-c', 'import os; print(os.environ["PYFAI_WITH_OPENMP"])') + if res.returncode() == 0 + openmp_var = res.stdout().strip() + else + openmp_var = '' + endif endif - cc = meson.get_compiler('c') cpp = meson.get_compiler('cpp') cy = meson.get_compiler('cython') @@ -34,8 +40,6 @@ if m_dep.found() endif # https://mesonbuild.com/Python-module.html -py_mod = import('python') -py = py_mod.find_installation() py_dep = py.dependency() py.install_sources([ From 5f5c149358557605d294365165303d12972d37eb Mon Sep 17 00:00:00 2001 From: Jerome Kieffer Date: Fri, 17 May 2024 15:07:29 +0200 Subject: [PATCH 2/2] use environment variable for cibuildwheel --- .github/workflows/release.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b60974fa3..283f26402 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -114,8 +114,7 @@ jobs: # Use silx wheelhouse: needed for ppc64le CIBW_ENVIRONMENT_LINUX: "PIP_FIND_LINKS=https://www.silx.org/pub/wheelhouse/ PIP_TRUSTED_HOST=www.silx.org" # diable OpenMP under windows - CIBW_ENVIRONMENT_WINDOWS: > - CIBW_BEFORE_BUILD="${{ echo False > PYFAI_WITH_OPENMP }}" + CIBW_ENVIRONMENT_WINDOWS: "PYFAI_WITH_OPENMP=False" CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* cp311-* cp312-* # Do not build for pypy and muslinux