Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions docs/deprecations.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ Deprecated features
Below are features which are considered deprecated. Where appropriate,
a :py:exc:`DeprecationWarning` is issued.

ImageDraw.getdraw hints parameter
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. deprecated:: 10.4.0

The ``hints`` parameter in :py:meth:`~PIL.ImageDraw.getdraw()` has been deprecated.

ExifTags.IFD.Makernote
^^^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -186,6 +179,7 @@ ICNS (width, height, scale) sizes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. deprecated:: 11.0.0
.. versionremoved:: 12.0.0

Setting an ICNS image size to ``(width, height, scale)`` before loading has been
removed. Instead, ``load(scale)`` can be used.
Expand Down
2 changes: 1 addition & 1 deletion docs/installation/building-from-source.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Many of Pillow's features require external libraries:

* **libtiff** provides compressed TIFF functionality

* Pillow has been tested with libtiff versions **3.x** and **4.0-4.7.0**
* Pillow has been tested with libtiff versions **4.0-4.7.0**

* **libfreetype** provides type related services

Expand Down
19 changes: 2 additions & 17 deletions src/PIL/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import PIL

from . import Image
from ._deprecate import deprecate

modules = {
"pil": ("PIL._imaging", "PILLOW_VERSION"),
Expand Down Expand Up @@ -120,7 +119,7 @@ def get_supported_codecs() -> list[str]:
return [f for f in codecs if check_codec(f)]


features: dict[str, tuple[str, str | bool, str | None]] = {
features: dict[str, tuple[str, str, str | None]] = {
"raqm": ("PIL._imagingft", "HAVE_RAQM", "raqm_version"),
"fribidi": ("PIL._imagingft", "HAVE_FRIBIDI", "fribidi_version"),
"harfbuzz": ("PIL._imagingft", "HAVE_HARFBUZZ", "harfbuzz_version"),
Expand All @@ -146,12 +145,8 @@ def check_feature(feature: str) -> bool | None:

module, flag, ver = features[feature]

if isinstance(flag, bool):
deprecate(f'check_feature("{feature}")', 12)
try:
imported_module = __import__(module, fromlist=["PIL"])
if isinstance(flag, bool):
return flag
return getattr(imported_module, flag)
except ModuleNotFoundError:
return None
Expand Down Expand Up @@ -181,17 +176,7 @@ def get_supported_features() -> list[str]:
"""
:returns: A list of all supported features.
"""
supported_features = []
for f, (module, flag, _) in features.items():
if flag is True:
for feature, (feature_module, _) in modules.items():
if feature_module == module:
if check_module(feature):
supported_features.append(f)
break
elif check_feature(f):
supported_features.append(f)
return supported_features
return [f for f in features if check_feature(f)]


def check(feature: str) -> bool | None:
Expand Down
Loading