mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-10-31 07:57:27 +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] |     assert list(map(type, v)) == [str, str, str, str] | ||||||
| 
 | 
 | ||||||
|     # internal version number |     # 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() |     skip_missing() | ||||||
|     i = ImageCms.profileToProfile(hopper(), SRGB, SRGB) |     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. |         If ``True``, a list of all supported image file formats will be printed. | ||||||
|     """ |     """ | ||||||
| 
 | 
 | ||||||
|  |     from pkg_resources import parse_version | ||||||
|  | 
 | ||||||
|     if out is None: |     if out is None: | ||||||
|         out = sys.stdout |         out = sys.stdout | ||||||
| 
 | 
 | ||||||
|  | @ -269,7 +271,10 @@ def pilinfo(out=None, supported_formats=True): | ||||||
|             else: |             else: | ||||||
|                 v = version(name) |                 v = version(name) | ||||||
|             if v is not None: |             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) |                 print("---", feature, "support ok,", t, v, file=out) | ||||||
|             else: |             else: | ||||||
|                 print("---", feature, "support ok", file=out) |                 print("---", feature, "support ok", file=out) | ||||||
|  |  | ||||||
|  | @ -1512,8 +1512,16 @@ setup_module(PyObject* m) { | ||||||
| 
 | 
 | ||||||
|     d = PyModule_GetDict(m); |     d = PyModule_GetDict(m); | ||||||
| 
 | 
 | ||||||
|  | #if LCMS_VERSION < 2070 | ||||||
|  |     vn = LCMS_VERSION; | ||||||
|  | #else | ||||||
|     vn = cmsGetEncodedCMMversion(); |     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); |     PyDict_SetItemString(d, "littlecms_version", v); | ||||||
| 
 | 
 | ||||||
|     return 0; |     return 0; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user