From e33dd498f5f702fc47b42087773fc8f3b04c418d Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 11 Apr 2018 12:05:09 +0300 Subject: [PATCH 1/8] Prefer more conventional __version__ rather than PILLOW_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 bf187f2d4..dfc6ae800 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, PILLOW_VERSION, __version__, _plugins from ._util import py3 import logging @@ -59,13 +59,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 d80ed2e948d508a9187ad457399265741fe03aa6 Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 11 Apr 2018 12:16:34 +0300 Subject: [PATCH 2/8] Deprecate PILLOW_VERSION and VERSION, use __version__ instead --- src/PIL/Image.py | 1 + src/PIL/__init__.py | 1 + 2 files changed, 2 insertions(+) diff --git a/src/PIL/Image.py b/src/PIL/Image.py index dfc6ae800..0b9c52899 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -24,6 +24,7 @@ # See the README file for information on usage and redistribution. # +# PILLOW_VERSION and VERSION are deprecated and will be removed in Pillow 6.0.0. Use __version__ instead. from . import VERSION, PILLOW_VERSION, __version__, _plugins from ._util import py3 diff --git a/src/PIL/__init__.py b/src/PIL/__init__.py index 012586fa4..7b8f0595f 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. VERSION = '1.1.7' # PIL Version PILLOW_VERSION = __version__ = _version.__version__ From 34d66494ca0fda6f7ebe5fad546521fddc36ddae Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 11 Apr 2018 15:54:06 +0300 Subject: [PATCH 3/8] Keep Image.VERSION here --- src/PIL/ImageCms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PIL/ImageCms.py b/src/PIL/ImageCms.py index 640f8953f..d82e30efc 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 312b91717cd076731137810e55eb13267c1aa8aa Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 11 Apr 2018 16:03:52 +0300 Subject: [PATCH 4/8] Document deprecations in release note --- docs/releasenotes/5.2.0.rst | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/releasenotes/5.2.0.rst b/docs/releasenotes/5.2.0.rst index 073daaf03..477bb32e4 100644 --- a/docs/releasenotes/5.2.0.rst +++ b/docs/releasenotes/5.2.0.rst @@ -1,6 +1,17 @@ 5.2.0 ----- +API Changes +=========== + +Deprecations +^^^^^^^^^^^^ + +Two version constants – ``VERSION`` (the old PIL version 1.1.7) and +``PILLOW_VERSION`` – have been deprecated and will be removed in the next +major release. Use ``__version__`` instead. + + API Additions ============= From 3508d679991b92d956857ff02640ddaa64808aa7 Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 11 Apr 2018 17:02:24 +0300 Subject: [PATCH 5/8] Explicitly enumerate version constants --- docs/releasenotes/5.2.0.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/releasenotes/5.2.0.rst b/docs/releasenotes/5.2.0.rst index 477bb32e4..2ae6ee292 100644 --- a/docs/releasenotes/5.2.0.rst +++ b/docs/releasenotes/5.2.0.rst @@ -7,9 +7,15 @@ API Changes Deprecations ^^^^^^^^^^^^ -Two version constants – ``VERSION`` (the old PIL version 1.1.7) and -``PILLOW_VERSION`` – have been deprecated and will be removed in the next -major release. Use ``__version__`` instead. +These version constants have been deprecated and will be removed in the next +major release: + +* ``PIL.VERSION`` (old PIL version 1.1.7) +* ``PIL.PILLOW_VERSION`` +* ``PIL.Image.VERSION`` +* ``PIL.Image.PILLOW_VERSION`` + +Use ``__version__`` instead. API Additions From c18dce5625755564e7664f617f5dc7b277d03d01 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sun, 15 Apr 2018 10:37:50 +0300 Subject: [PATCH 6/8] 'Use PIL.__version__ instead.' --- docs/releasenotes/5.2.0.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/releasenotes/5.2.0.rst b/docs/releasenotes/5.2.0.rst index 2ae6ee292..88e34f666 100644 --- a/docs/releasenotes/5.2.0.rst +++ b/docs/releasenotes/5.2.0.rst @@ -15,7 +15,7 @@ major release: * ``PIL.Image.VERSION`` * ``PIL.Image.PILLOW_VERSION`` -Use ``__version__`` instead. +Use ``PIL.__version__`` instead. API Additions From ef9bf76ce836d04630c48122cb828eba751096f0 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sun, 22 Apr 2018 22:00:39 +0300 Subject: [PATCH 7/8] PILLOW_VERSION will be removed in a future release --- docs/releasenotes/5.2.0.rst | 4 ++-- src/PIL/Image.py | 4 +++- src/PIL/__init__.py | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/releasenotes/5.2.0.rst b/docs/releasenotes/5.2.0.rst index 88e34f666..3a86a1d11 100644 --- a/docs/releasenotes/5.2.0.rst +++ b/docs/releasenotes/5.2.0.rst @@ -7,8 +7,8 @@ API Changes Deprecations ^^^^^^^^^^^^ -These version constants have been deprecated and will be removed in the next -major release: +These version constants have been deprecated. ``VERSION`` will be removed in +Pillow 6.0.0, and ``PILLOW_VERSION`` will be removed in a future release. * ``PIL.VERSION`` (old PIL version 1.1.7) * ``PIL.PILLOW_VERSION`` diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 0b9c52899..87cfc5a02 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -24,7 +24,9 @@ # See the README file for information on usage and redistribution. # -# PILLOW_VERSION and VERSION are deprecated and will be removed in Pillow 6.0.0. Use __version__ instead. +# VERSION is deprecated and will be removed in Pillow 6.0.0. +# PILLOW_VERSION is deprecated and will be removed in a future release. +# Use __version__ instead. from . import VERSION, PILLOW_VERSION, __version__, _plugins from ._util import py3 diff --git a/src/PIL/__init__.py b/src/PIL/__init__.py index 7b8f0595f..5806a2174 100644 --- a/src/PIL/__init__.py +++ b/src/PIL/__init__.py @@ -13,7 +13,9 @@ from . import _version -# PILLOW_VERSION and VERSION are deprecated and will be removed in Pillow 6.0.0. Use __version__ instead. +# VERSION is deprecated and will be removed in Pillow 6.0.0. +# PILLOW_VERSION is deprecated and will be removed in a future release. +# Use __version__ instead. VERSION = '1.1.7' # PIL Version PILLOW_VERSION = __version__ = _version.__version__ From de6baf65f364a5c2f39b9c84f99832fde55b1c3b Mon Sep 17 00:00:00 2001 From: Hugo Date: Wed, 25 Apr 2018 11:13:56 +0300 Subject: [PATCH 8/8] Clarify PILLOW_VERSION will be removed after VERSION --- docs/releasenotes/5.2.0.rst | 2 +- src/PIL/Image.py | 2 +- src/PIL/__init__.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/releasenotes/5.2.0.rst b/docs/releasenotes/5.2.0.rst index 3a86a1d11..65b2d8fd1 100644 --- a/docs/releasenotes/5.2.0.rst +++ b/docs/releasenotes/5.2.0.rst @@ -8,7 +8,7 @@ Deprecations ^^^^^^^^^^^^ These version constants have been deprecated. ``VERSION`` will be removed in -Pillow 6.0.0, and ``PILLOW_VERSION`` will be removed in a future release. +Pillow 6.0.0, and ``PILLOW_VERSION`` will be removed after that. * ``PIL.VERSION`` (old PIL version 1.1.7) * ``PIL.PILLOW_VERSION`` diff --git a/src/PIL/Image.py b/src/PIL/Image.py index 87cfc5a02..1954c52ee 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -25,7 +25,7 @@ # # VERSION is deprecated and will be removed in Pillow 6.0.0. -# PILLOW_VERSION is deprecated and will be removed in a future release. +# PILLOW_VERSION is deprecated and will be removed after that. # Use __version__ instead. from . import VERSION, PILLOW_VERSION, __version__, _plugins from ._util import py3 diff --git a/src/PIL/__init__.py b/src/PIL/__init__.py index 5806a2174..eee0abde5 100644 --- a/src/PIL/__init__.py +++ b/src/PIL/__init__.py @@ -14,7 +14,7 @@ from . import _version # VERSION is deprecated and will be removed in Pillow 6.0.0. -# PILLOW_VERSION is deprecated and will be removed in a future release. +# PILLOW_VERSION is deprecated and will be removed after that. # Use __version__ instead. VERSION = '1.1.7' # PIL Version PILLOW_VERSION = __version__ = _version.__version__