Skip to content

Commit

Permalink
Codechange: Simplify Pillow version detection
Browse files Browse the repository at this point in the history
Previously, this tried various combinations of version variables.
However, some of these are deprecated by Pillow and the 6.0.0 release
notes recommend simply using `PIL.__version` instead. This attribute is
available since Pillow 3.4.0, so there is no need for any compatibility
fallbacks.

This relates to #29, #39 and #54.
  • Loading branch information
matthijskooijman authored and LordAro committed Nov 29, 2019
1 parent 09e8bf8 commit 04d2e16
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions nml/version_info.py
Expand Up @@ -138,20 +138,10 @@ def get_lib_versions():
versions = {}
#PIL
try:
from PIL import Image
try:
versions["PIL"] = Image.__version__
except AttributeError:
versions["PIL"] = Image.PILLOW_VERSION
import PIL
versions["PIL"] = PIL.__version__
except ImportError:
try:
import Image
try:
versions["PIL"] = Image.__version__
except AttributeError:
versions["PIL"] = Image.PILLOW_VERSION
except ImportError:
versions["PIL"] = "Not found!"
versions["PIL"] = "Not found!"

#PLY
try:
Expand Down

0 comments on commit 04d2e16

Please sign in to comment.