mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
compatibility for LCMS<2.7, vix LCMS version string
This commit is contained in:
parent
934c44b3c3
commit
40c9a5a2a0
|
@ -48,7 +48,7 @@ def test_sanity():
|
|||
assert list(map(type, v)) == [str, str, str, str]
|
||||
|
||||
# internal version number
|
||||
assert re.search(r"\d+\.\d+$", features.version_module("littlecms2"))
|
||||
assert re.search(r"\d+\.\d+(\.\d+)?$", features.version_module("littlecms2"))
|
||||
|
||||
skip_missing()
|
||||
i = ImageCms.profileToProfile(hopper(), SRGB, SRGB)
|
||||
|
|
|
@ -224,6 +224,8 @@ def pilinfo(out=None, supported_formats=True):
|
|||
If ``True``, a list of all supported image file formats will be printed.
|
||||
"""
|
||||
|
||||
from pkg_resources import parse_version
|
||||
|
||||
if out is None:
|
||||
out = sys.stdout
|
||||
|
||||
|
@ -269,7 +271,10 @@ def pilinfo(out=None, supported_formats=True):
|
|||
else:
|
||||
v = version(name)
|
||||
if v is not None:
|
||||
t = "compiled for" if name in ("pil", "jpg") else "loaded"
|
||||
version_static = name in ("pil", "jpg")
|
||||
if name == "littlecms2":
|
||||
version_static = parse_version(v) < parse_version("2.7.0")
|
||||
t = "compiled for" if version_static else "loaded"
|
||||
print("---", feature, "support ok,", t, v, file=out)
|
||||
else:
|
||||
print("---", feature, "support ok", file=out)
|
||||
|
|
|
@ -1512,8 +1512,16 @@ setup_module(PyObject* m) {
|
|||
|
||||
d = PyModule_GetDict(m);
|
||||
|
||||
#if LCMS_VERSION < 2070
|
||||
vn = LCMS_VERSION;
|
||||
#else
|
||||
vn = cmsGetEncodedCMMversion();
|
||||
v = PyUnicode_FromFormat("%d.%d", vn / 100, vn % 100);
|
||||
#endif
|
||||
if (vn % 10) {
|
||||
v = PyUnicode_FromFormat("%d.%d.%d", vn / 1000, (vn / 10) % 100, vn % 10);
|
||||
} else {
|
||||
v = PyUnicode_FromFormat("%d.%d", vn / 1000, (vn / 10) % 100);
|
||||
}
|
||||
PyDict_SetItemString(d, "littlecms_version", v);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue
Block a user