Check for presence of jxl_threads

This commit is contained in:
Andrew Murray 2025-12-16 19:52:55 +11:00
parent 0b70b34f19
commit 52912c3d9f
2 changed files with 6 additions and 6 deletions

View File

@ -783,7 +783,9 @@ class pil_build_ext(build_ext):
if _find_include_file(self, "jxl/encode.h") and _find_include_file(
self, "jxl/decode.h"
):
if _find_library_file(self, "jxl"):
if _find_library_file(self, "jxl") and _find_library_file(
self, "jxl_threads"
):
feature.set("jpegxl", "jxl")
if feature.want("imagequant"):
@ -1012,7 +1014,6 @@ class pil_build_ext(build_ext):
jpegxl = feature.get("jpegxl")
if isinstance(jpegxl, str):
# jxl and jxl_threads are required
libs = [jpegxl, jpegxl + "_threads"]
self._update_extension("PIL._jpegxl", libs)
else:

View File

@ -1,6 +1,5 @@
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <stdbool.h>
#include "libImaging/Imaging.h"
#include <jxl/codestream_header.h>
@ -295,8 +294,8 @@ decoder_loop_skip_process:
decp->status = JxlDecoderGetBoxType(decp->decoder, btype, JXL_TRUE);
_JXL_CHECK("JxlDecoderGetBoxType");
bool is_box_exif = !memcmp(btype, "Exif", 4);
bool is_box_xmp = !memcmp(btype, "xml ", 4);
int is_box_exif = !memcmp(btype, "Exif", 4);
int is_box_xmp = !memcmp(btype, "xml ", 4);
if (!is_box_exif && !is_box_xmp) {
// not exif/xmp box so continue
continue;
@ -472,6 +471,7 @@ end:
decp->status
);
PyErr_SetString(PyExc_OSError, err_msg);
return NULL;
}
PyObject *
@ -562,7 +562,6 @@ setup_module(PyObject *m) {
return -1;
}
// TODO(oloke) ready object types?
PyObject *d = PyModule_GetDict(m);
PyObject *v = PyUnicode_FromString(JpegXlDecoderVersion_str());
PyDict_SetItemString(d, "libjxl_version", v ? v : Py_None);