tests: find libjpeg-turbo by TURBOJPEG_PATH, not LD_LIBRARY_PATH

The unit check failed with the library present:  in nativeBuildInputs is a
nix wrapper that sets LD_LIBRARY_PATH itself, so an export from the builder script
is overwritten before the tests run. TURBOJPEG_PATH is read first by
jpeg._load_library, no wrapper touches it, and the package's console scripts now
set it too.
This commit is contained in:
Hermenix committed 2026-10-11 23:01:25 +00:00
1 parent 7190960120
commit a417a6919d
2 files changed
+12

No files matched your search

+6
View File
@@ -71,7 +71,13 @@ runCommand "hhstream-unit"
# library -- and it needs the *loader* to find it, because the encoder reaches
# it through `ctypes` and nothing links it. Same reason nix/package.nix wraps
# the console scripts with this path.
#
# `TURBOJPEG_PATH` decides, not `LD_LIBRARY_PATH`: the `pytest` in
# `nativeBuildInputs` is a nix wrapper that sets `LD_LIBRARY_PATH` itself, so
# exporting it here had no effect and the suite failed with the library plainly
# present on the machine. `jpeg._load_library` reads this variable first.
export LD_LIBRARY_PATH=${libjpeg_turbo}/lib
export TURBOJPEG_PATH=${libjpeg_turbo}/lib/libturbojpeg.so
export PYTHONDONTWRITEBYTECODE=1
export HOME=$PWD
python3 -c 'import hhstream; print("testing hhstream", hhstream.__version__, "from", hhstream.__file__)'
+6
View File
@@ -31,8 +31,14 @@ python3.pkgs.buildPythonApplication {
# LD_LIBRARY_PATH. The wrapper is what makes `ctypes.util.find_library` succeed
# inside the unit -- and it is the same library grim already links, so the
# frames stay byte-compatible with the existing stream.
#
# Both variables, deliberately. `LD_LIBRARY_PATH` is the conventional one, but
# a nix Python wrapper sets that variable *itself* -- which is how the unit
# check failed with the library plainly present -- so `TURBOJPEG_PATH` is the
# one that actually decides, and `jpeg._load_library` checks it first.
makeWrapperArgs = [
"--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ libjpeg_turbo ]}"
"--set TURBOJPEG_PATH ${libjpeg_turbo}/lib/libturbojpeg.so"
];
# Unit tests are wired up in the flake's `checks` so they can run without