#1149461 pyopencl: FTBFS: FAILED test_array.py::test_xdg_cache_home[<context factory for <pyopencl.Device 'cpu-skylake-avx512-AMD EPYC 9R14' on 'Portable Computing Language'>>] - FileNotFoundError: [Errno 2] No such file or directory: 'tmpdir_pyopencl_xdg_test'

Package:
src:pyopencl
Source:
src:pyopencl
Submitter:
Santiago Vila
Date:
2026-10-20 06:35:03 UTC
Severity:
normal
Tags:
#1149461#5
Date:
2026-09-29 23:06:10 UTC
From:
To:
Dear maintainer:

During a rebuild of all packages in unstable, this package failed to build.

Below you will find the last part of the build log (probably the most
relevant part, but not necessarily). If required, the full build log
is available here:

https://people.debian.org/~sanvila/build-logs/202609/

About the archive rebuild: The build was made on virtual machines from AWS,
using sbuild and a reduced chroot with only build-essential packages.

If you cannot reproduce the bug please contact me privately, as I
am willing to provide ssh access to a virtual machine where the bug is
fully reproducible.

If this is really a bug in one of the build-depends, please use
reassign and add an affects on src:pyopencl, so that this is still
visible in the BTS web page for this package.

Thanks.
--------------------------------------------------------------------------------
[...]
  /<<PKGBUILDDIR>>/.pybuild/cpython3_3.14/build/test/test_wrapper.py:1513: DeprecationWarning: Non-descriptor Image constructor called. This will stop working in 2026. Use create_image instead (with the same arguments).
    image2_array_cl = cl.Image(ctx, cl.mem_flags.WRITE_ONLY,

#1149461#10
Date:
2026-10-19 22:30:40 UTC
From:
To:
Cause: python3-platformdirs 4.11.8 and later (sid has 4.11.9-1) ignores
a relative XDG_CACHE_HOME (tox-dev/platformdirs PR #540).
test_xdg_cache_home sets a relative path, so the directory is never
created. Upstream fixed the test only:
https://github.com/inducer/pyopencl/commit/f223914286484ce3f7a5ed0560981928506d61e0

The patch below has a DEP-3 header. Save it as
debian/patches/fix-test-xdg-cache-home-relative-path.patch and add that
name to debian/patches/series. It applies to 2025.1-2. On 2026-10-19 in
a sid container with pocl CPU, the unpatched test fails as reported and
the patched test passes against the built extension. We did not rerun
the full suite or autopkgtest. This mail is copied to #1148802, which
reports the same test failing in autopkgtest; autopkgtest runs this same
test/test_array.py.

Prepared by CyberNative AI LLC, an AI-run company, using AI agents.

Description: Fix test_xdg_cache_home with platformdirs >= 4.11.8
 platformdirs now ignores a relative XDG_CACHE_HOME (tox-dev/platformdirs
 PR #540), so the cache directory is created elsewhere and the test, which
 set XDG_CACHE_HOME to a relative name, fails. Use an absolute path instead.
Author: Alexandru Fikl <alexfikl@gmail.com>
Origin: upstream, https://github.com/inducer/pyopencl/commit/f223914286484ce3f7a5ed0560981928506d61e0
Bug-Debian: https://bugs.debian.org/1149461
Forwarded: not-needed
Last-Update: 2026-10-19
Index: pyopencl-2025.1/test/test_array.py
===================================================================
--- pyopencl-2025.1.orig/test/test_array.py
+++ pyopencl-2025.1/test/test_array.py
@@ -2346,8 +2346,8 @@ def test_logical_not(ctx_factory):
                     reason="XDG_CACHE_HOME is not used on Windows")
 def test_xdg_cache_home(ctx_factory):
     import os
+    import pathlib
     import shutil
-    from os.path import join

     context = ctx_factory()
     queue = cl.CommandQueue(context)
@@ -2355,13 +2355,13 @@ def test_xdg_cache_home(ctx_factory):
     a = np.array([1, 2, 3, 4, 5]).astype(np.float32)
     a_gpu = cl_array.to_device(queue, a)

-    xdg_dir = "tmpdir_pyopencl_xdg_test"
+    xdg_dir = pathlib.Path("tmpdir_pyopencl_xdg_test").resolve()

     # PyOpenCL uses pytools.PersistentDict for invoker caches,
     # which is why xdg_dir will always exist. Therefore, check
     # whether xdg_pyopencl_dir exists.
-    xdg_pyopencl_dir = join(xdg_dir, "pyopencl")
-    assert not os.path.exists(xdg_dir)
+    xdg_pyopencl_dir = xdg_dir / "pyopencl"
+    assert not xdg_dir.exists()

     old_xdg_cache_home = None
     old_characterize_has_src_build_cache = None
@@ -2373,12 +2373,12 @@ def test_xdg_cache_home(ctx_factory):
         cl.characterize.has_src_build_cache = lambda dev: False

         old_xdg_cache_home = os.getenv("XDG_CACHE_HOME")
-        os.environ["XDG_CACHE_HOME"] = xdg_dir
+        os.environ["XDG_CACHE_HOME"] = str(xdg_dir)

         result = pow(a_gpu, a_gpu).get()
         assert (np.abs(a ** a - result) < 3e-3).all()

-        assert os.path.exists(xdg_pyopencl_dir)
+        assert xdg_pyopencl_dir.exists()
     finally:
         cl.characterize.has_src_build_cache = \
             old_characterize_has_src_build_cache