From 05efb466d1ba42ffa626082f8624d52a1050c88d Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 24 Aug 2026 13:39:23 -0400 Subject: [PATCH 1/2] bufr: use an executable temporary directory for f2py Meson builds --- repos/spack_repo/builtin/packages/bufr/package.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/repos/spack_repo/builtin/packages/bufr/package.py b/repos/spack_repo/builtin/packages/bufr/package.py index f6d5ba68e56..f901a0a7b73 100644 --- a/repos/spack_repo/builtin/packages/bufr/package.py +++ b/repos/spack_repo/builtin/packages/bufr/package.py @@ -154,6 +154,13 @@ def setup_run_environment(self, env: EnvironmentModifications) -> None: def setup_build_environment(self, env: EnvironmentModifications) -> None: env.append_path("LD_LIBRARY_PATH", join_path(self.build_directory, "src")) + # NumPy f2py uses Meson on Python 3.12 and newer. Direct its + # compiler sanity check away from a possibly noexec /tmp mount. + if self.spec.satisfies("+python ^python@3.12:"): + tmpdir = join_path(self.stage.path, "tmp") + mkdirp(tmpdir) + env.set("TMPDIR", tmpdir) + def check(self): with working_dir(self.build_directory): if self.spec.satisfies("@:12.0 +python"): From 09272cb297e3b37c8605870c0edbb4bbce29b238 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Mon, 24 Aug 2026 15:30:25 -0400 Subject: [PATCH 2/2] Correct fix for freaking f2py --- .../builtin/packages/bufr/package.py | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/repos/spack_repo/builtin/packages/bufr/package.py b/repos/spack_repo/builtin/packages/bufr/package.py index f901a0a7b73..da53b21be19 100644 --- a/repos/spack_repo/builtin/packages/bufr/package.py +++ b/repos/spack_repo/builtin/packages/bufr/package.py @@ -89,9 +89,21 @@ def url_for_version(self, version): # Need to make the lines shorter at least on some systems def patch(self): - with when("@:11.7.1"): + if self.spec.satisfies("@:11.7.1"): filter_file("_lenslmax 120", "_lenslmax 60", "CMakeLists.txt") + # NumPy f2py uses Meson on Python 3.12 and newer. Direct its + # temporary build directory to CMake's already-created binary tree, + # rather than the potentially noexec /tmp default. + if self.spec.satisfies("+python ^python@3.12:"): + filter_file( + '-c "${CMAKE_CURRENT_SOURCE_DIR}/_bufrlib.pyf"', + '-c "${CMAKE_CURRENT_SOURCE_DIR}/_bufrlib.pyf"\n' + ' --build-dir "${CMAKE_CURRENT_BINARY_DIR}/f2py-build"', + "python/CMakeLists.txt", + string=True, + ) + def cmake_args(self): args = [ self.define_from_variant("ENABLE_PYTHON", "python"), @@ -154,13 +166,6 @@ def setup_run_environment(self, env: EnvironmentModifications) -> None: def setup_build_environment(self, env: EnvironmentModifications) -> None: env.append_path("LD_LIBRARY_PATH", join_path(self.build_directory, "src")) - # NumPy f2py uses Meson on Python 3.12 and newer. Direct its - # compiler sanity check away from a possibly noexec /tmp mount. - if self.spec.satisfies("+python ^python@3.12:"): - tmpdir = join_path(self.stage.path, "tmp") - mkdirp(tmpdir) - env.set("TMPDIR", tmpdir) - def check(self): with working_dir(self.build_directory): if self.spec.satisfies("@:12.0 +python"):