From c2dbb0a3c59252b905e1ab8ece98283e46a3c19d Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 9 Apr 2018 17:59:58 +0300 Subject: [PATCH 1/3] Use a single version number, no need for confusing PIL version 1.1.7 --- Tests/test_000_sanity.py | 2 -- src/PIL/__init__.py | 5 +---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/Tests/test_000_sanity.py b/Tests/test_000_sanity.py index 67aff8ecc..387b5c246 100644 --- a/Tests/test_000_sanity.py +++ b/Tests/test_000_sanity.py @@ -11,8 +11,6 @@ class TestSanity(PillowTestCase): # Make sure we have the binary extension im = PIL.Image.core.new("L", (100, 100)) - self.assertEqual(PIL.Image.VERSION[:3], '1.1') - # Create an image and do stuff with it. im = PIL.Image.new("1", (100, 100)) self.assertEqual((im.mode, im.size), ('1', (100, 100))) diff --git a/src/PIL/__init__.py b/src/PIL/__init__.py index 76188a0a3..62ad95248 100644 --- a/src/PIL/__init__.py +++ b/src/PIL/__init__.py @@ -13,10 +13,7 @@ from . import version -VERSION = '1.1.7' # PIL Version -PILLOW_VERSION = version.__version__ - -__version__ = PILLOW_VERSION +PILLOW_VERSION = VERSION = __version__ = version.__version__ _plugins = ['BlpImagePlugin', 'BmpImagePlugin', From 60e4318f9aec575bc69af7d331d1633427aed608 Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 9 Apr 2018 18:20:37 +0300 Subject: [PATCH 2/3] Use more conventional __version__ rather than PILLOW_VERSION or VERSION --- Tests/test_pyroma.py | 4 ++-- docs/conf.py | 4 ++-- selftest.py | 2 +- src/PIL/Image.py | 6 +++--- src/PIL/ImageCms.py | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Tests/test_pyroma.py b/Tests/test_pyroma.py index 962535f03..cf5fc361f 100644 --- a/Tests/test_pyroma.py +++ b/Tests/test_pyroma.py @@ -1,6 +1,6 @@ from helper import unittest, PillowTestCase -from PIL import PILLOW_VERSION +from PIL import __version__ try: import pyroma @@ -26,7 +26,7 @@ class TestPyroma(PillowTestCase): rating = pyroma.ratings.rate(data) # Assert - if 'rc' in PILLOW_VERSION: + if 'rc' in __version__: # Pyroma needs to chill about RC versions # and not kill all our tests. self.assertEqual(rating, (9, [ diff --git a/docs/conf.py b/docs/conf.py index 4053e24e6..ba0a552b3 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -53,9 +53,9 @@ author = u'Fredrik Lundh, Alex Clark and Contributors' # # The short X.Y version. import PIL -version = PIL.PILLOW_VERSION +version = PIL.__version__ # The full version, including alpha/beta/rc tags. -release = PIL.PILLOW_VERSION +release = PIL.__version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/selftest.py b/selftest.py index 3f358c583..ed2ba815f 100755 --- a/selftest.py +++ b/selftest.py @@ -161,7 +161,7 @@ if __name__ == "__main__": exit_status = 0 print("-"*68) - print("Pillow", Image.PILLOW_VERSION, "TEST SUMMARY ") + print("Pillow", Image.__version__, "TEST SUMMARY ") print("-"*68) print("Python modules loaded from", os.path.dirname(Image.__file__)) print("Binary modules loaded from", os.path.dirname(Image.core.__file__)) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 22ee46bfc..60259ce55 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -24,7 +24,7 @@ # See the README file for information on usage and redistribution. # -from . import VERSION, PILLOW_VERSION, _plugins +from . import __version__, _plugins import logging import warnings @@ -58,13 +58,13 @@ try: # Also note that Image.core is not a publicly documented interface, # and should be considered private and subject to change. from . import _imaging as core - if PILLOW_VERSION != getattr(core, 'PILLOW_VERSION', None): + if __version__ != getattr(core, 'PILLOW_VERSION', None): raise ImportError("The _imaging extension was built for another " "version of Pillow or PIL:\n" "Core version: %s\n" "Pillow version: %s" % (getattr(core, 'PILLOW_VERSION', None), - PILLOW_VERSION)) + __version__)) except ImportError as v: core = _imaging_not_installed() diff --git a/src/PIL/ImageCms.py b/src/PIL/ImageCms.py index d82e30efc..640f8953f 100644 --- a/src/PIL/ImageCms.py +++ b/src/PIL/ImageCms.py @@ -951,5 +951,5 @@ def versions(): return ( VERSION, core.littlecms_version, - sys.version.split()[0], Image.VERSION + sys.version.split()[0], Image.__version__ ) From 9f4ba9922dfae68c4816e3cc3105c321ed150b67 Mon Sep 17 00:00:00 2001 From: Hugo Date: Mon, 9 Apr 2018 18:39:24 +0300 Subject: [PATCH 3/3] Deprecate PILLOW_VERSION and VERSION, use __version__ instead --- src/PIL/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/PIL/__init__.py b/src/PIL/__init__.py index 62ad95248..4ed2e4775 100644 --- a/src/PIL/__init__.py +++ b/src/PIL/__init__.py @@ -13,6 +13,7 @@ from . import version +# PILLOW_VERSION and VERSION are deprecated and will be removed in Pillow 6.0.0. Use __version__ instead. PILLOW_VERSION = VERSION = __version__ = version.__version__ _plugins = ['BlpImagePlugin',