mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-10 19:56:47 +03:00
Replaced distutils with C version check
This commit is contained in:
parent
a1635ac6c4
commit
34d04d3e82
|
@ -1,5 +1,4 @@
|
|||
import base64
|
||||
import distutils.version
|
||||
import io
|
||||
import itertools
|
||||
import logging
|
||||
|
@ -272,12 +271,8 @@ class TestFileLibTiff(LibTiffTestCase):
|
|||
)
|
||||
}
|
||||
|
||||
libtiff_version = TiffImagePlugin._libtiff_version()
|
||||
|
||||
libtiffs = [False]
|
||||
if distutils.version.StrictVersion(
|
||||
libtiff_version
|
||||
) >= distutils.version.StrictVersion("4.0"):
|
||||
if Image.core.libtiff_v4_or_greater:
|
||||
libtiffs.append(True)
|
||||
|
||||
for libtiff in libtiffs:
|
||||
|
|
|
@ -38,7 +38,6 @@
|
|||
#
|
||||
# See the README file for information on usage and redistribution.
|
||||
#
|
||||
import distutils.version
|
||||
import io
|
||||
import itertools
|
||||
import os
|
||||
|
@ -1559,11 +1558,10 @@ def _save(im, fp, filename):
|
|||
# Custom items are supported for int, float, unicode, string and byte
|
||||
# values. Other types and tuples require a tagtype.
|
||||
if tag not in TiffTags.LIBTIFF_CORE:
|
||||
if TiffTags.lookup(tag).type == TiffTags.UNDEFINED:
|
||||
continue
|
||||
if distutils.version.StrictVersion(
|
||||
_libtiff_version()
|
||||
) < distutils.version.StrictVersion("4.0"):
|
||||
if (
|
||||
TiffTags.lookup(tag).type == TiffTags.UNDEFINED
|
||||
or not Image.core.libtiff_v4_or_greater
|
||||
):
|
||||
continue
|
||||
|
||||
if tag in ifd.tagtype:
|
||||
|
|
|
@ -82,6 +82,12 @@
|
|||
#include "zlib.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LIBTIFF
|
||||
#ifndef _TIFFIO_
|
||||
#include <tiffio.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "Imaging.h"
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
|
@ -3961,6 +3967,15 @@ setup_module(PyObject* m) {
|
|||
{
|
||||
extern const char * ImagingTiffVersion(void);
|
||||
PyDict_SetItemString(d, "libtiff_version", PyUnicode_FromString(ImagingTiffVersion()));
|
||||
|
||||
// Test for libtiff 4.0 or later, excluding libtiff 3.9.6 and 3.9.7
|
||||
PyObject* v4_or_greater;
|
||||
#if TIFFLIB_VERSION >= 20111221 && TIFFLIB_VERSION != 20120218 && TIFFLIB_VERSION != 20120922
|
||||
v4_or_greater = Py_True;
|
||||
#else
|
||||
v4_or_greater = Py_False;
|
||||
#endif
|
||||
PyDict_SetItemString(d, "libtiff_v4_or_greater", v4_or_greater);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user