mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-03 13:14:27 +03:00
Do not require packaging just for a DeprecationWarning
This commit is contained in:
parent
cfc45ab9c3
commit
043d8dac0b
|
@ -31,8 +31,6 @@ import sys
|
||||||
import warnings
|
import warnings
|
||||||
from io import BytesIO
|
from io import BytesIO
|
||||||
|
|
||||||
from packaging.version import parse as parse_version
|
|
||||||
|
|
||||||
from . import Image, features
|
from . import Image, features
|
||||||
from ._util import isDirectory, isPath
|
from ._util import isDirectory, isPath
|
||||||
|
|
||||||
|
@ -167,14 +165,20 @@ class FreeTypeFont:
|
||||||
self.index = index
|
self.index = index
|
||||||
self.encoding = encoding
|
self.encoding = encoding
|
||||||
|
|
||||||
freetype_version = parse_version(features.version_module("freetype2"))
|
try:
|
||||||
if freetype_version < parse_version("2.8"):
|
from packaging.version import parse as parse_version
|
||||||
warnings.warn(
|
except ImportError:
|
||||||
"Support for FreeType 2.7 is deprecated and will be removed in Pillow "
|
pass
|
||||||
"9 (2022-01-02). Please upgrade to FreeType 2.8 or newer, preferably "
|
else:
|
||||||
"FreeType 2.10.4 which fixes CVE-2020-15999.",
|
freetype_version = parse_version(features.version_module("freetype2"))
|
||||||
DeprecationWarning,
|
if freetype_version < parse_version("2.8"):
|
||||||
)
|
warnings.warn(
|
||||||
|
"Support for FreeType 2.7 is deprecated and will be removed"
|
||||||
|
" in Pillow 9 (2022-01-02). Please upgrade to FreeType 2.8 "
|
||||||
|
"or newer, preferably FreeType 2.10.4 which fixes "
|
||||||
|
"CVE-2020-15999.",
|
||||||
|
DeprecationWarning,
|
||||||
|
)
|
||||||
|
|
||||||
if layout_engine not in (LAYOUT_BASIC, LAYOUT_RAQM):
|
if layout_engine not in (LAYOUT_BASIC, LAYOUT_RAQM):
|
||||||
layout_engine = LAYOUT_BASIC
|
layout_engine = LAYOUT_BASIC
|
||||||
|
|
Loading…
Reference in New Issue
Block a user