Merge pull request #4963 from nulano/implicit-function

This commit is contained in:
Hugo van Kemenade 2020-10-12 19:23:40 +03:00 committed by GitHub
commit c7b0fe1bca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 4 deletions

View File

@ -64,7 +64,7 @@ install:
.PHONY: install-coverage
install-coverage:
CFLAGS="-coverage" python3 setup.py build_ext install
CFLAGS="-coverage -Werror=implicit-function-declaration" python3 setup.py build_ext install
python3 selftest.py
.PHONY: debug

View File

@ -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)

View File

@ -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)

View File

@ -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;