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