mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-03 11:35:52 +03:00
Removed PILLOW_VERSION
This commit is contained in:
parent
174fad7d3d
commit
cd50d468ba
|
@ -813,35 +813,6 @@ class TestImage:
|
||||||
with pytest.warns(DeprecationWarning):
|
with pytest.warns(DeprecationWarning):
|
||||||
assert Image.CONTAINER == 2
|
assert Image.CONTAINER == 2
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
|
||||||
"test_module",
|
|
||||||
[PIL, Image],
|
|
||||||
)
|
|
||||||
def test_pillow_version(self, test_module):
|
|
||||||
with pytest.warns(DeprecationWarning):
|
|
||||||
assert test_module.PILLOW_VERSION == PIL.__version__
|
|
||||||
|
|
||||||
with pytest.warns(DeprecationWarning):
|
|
||||||
str(test_module.PILLOW_VERSION)
|
|
||||||
|
|
||||||
with pytest.warns(DeprecationWarning):
|
|
||||||
assert int(test_module.PILLOW_VERSION[0]) >= 7
|
|
||||||
|
|
||||||
with pytest.warns(DeprecationWarning):
|
|
||||||
assert test_module.PILLOW_VERSION < "9.9.0"
|
|
||||||
|
|
||||||
with pytest.warns(DeprecationWarning):
|
|
||||||
assert test_module.PILLOW_VERSION <= "9.9.0"
|
|
||||||
|
|
||||||
with pytest.warns(DeprecationWarning):
|
|
||||||
assert test_module.PILLOW_VERSION != "7.0.0"
|
|
||||||
|
|
||||||
with pytest.warns(DeprecationWarning):
|
|
||||||
assert test_module.PILLOW_VERSION >= "7.0.0"
|
|
||||||
|
|
||||||
with pytest.warns(DeprecationWarning):
|
|
||||||
assert test_module.PILLOW_VERSION > "7.0.0"
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"path",
|
"path",
|
||||||
[
|
[
|
||||||
|
|
|
@ -51,17 +51,6 @@ ImageFile.raise_ioerror
|
||||||
So, ``ImageFile.raise_ioerror`` will be removed in Pillow 9.0.0 (2022-01-02).
|
So, ``ImageFile.raise_ioerror`` will be removed in Pillow 9.0.0 (2022-01-02).
|
||||||
Use ``ImageFile.raise_oserror`` instead.
|
Use ``ImageFile.raise_oserror`` instead.
|
||||||
|
|
||||||
PILLOW_VERSION constant
|
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
|
|
||||||
.. deprecated:: 5.2.0
|
|
||||||
|
|
||||||
``PILLOW_VERSION`` will be removed in Pillow 9.0.0 (2022-01-02).
|
|
||||||
Use ``__version__`` instead.
|
|
||||||
|
|
||||||
It was initially removed in Pillow 7.0.0, but brought back in 7.1.0 to give projects
|
|
||||||
more time to upgrade.
|
|
||||||
|
|
||||||
Tk/Tcl 8.4
|
Tk/Tcl 8.4
|
||||||
~~~~~~~~~~
|
~~~~~~~~~~
|
||||||
|
|
||||||
|
@ -109,6 +98,17 @@ Removed features
|
||||||
Deprecated features are only removed in major releases after an appropriate
|
Deprecated features are only removed in major releases after an appropriate
|
||||||
period of deprecation has passed.
|
period of deprecation has passed.
|
||||||
|
|
||||||
|
PILLOW_VERSION constant
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
.. deprecated:: 5.2.0
|
||||||
|
.. versionremoved:: 9.0.0
|
||||||
|
|
||||||
|
Use ``__version__`` instead.
|
||||||
|
|
||||||
|
It was initially removed in Pillow 7.0.0, but temporarily brought back in 7.1.0
|
||||||
|
to give projects more time to upgrade.
|
||||||
|
|
||||||
im.offset
|
im.offset
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
||||||
|
|
10
docs/releasenotes/9.0.0.rst
Normal file
10
docs/releasenotes/9.0.0.rst
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
9.0.0
|
||||||
|
-----
|
||||||
|
|
||||||
|
Backwards Incompatible Changes
|
||||||
|
==============================
|
||||||
|
|
||||||
|
PILLOW_VERSION constant
|
||||||
|
^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
``PILLOW_VERSION`` has been removed. Use ``__version__`` instead.
|
|
@ -14,6 +14,7 @@ expected to be backported to earlier versions.
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
|
9.0.0
|
||||||
8.4.0
|
8.4.0
|
||||||
8.3.2
|
8.3.2
|
||||||
8.3.1
|
8.3.1
|
||||||
|
|
|
@ -45,45 +45,28 @@ except ImportError:
|
||||||
ElementTree = None
|
ElementTree = None
|
||||||
|
|
||||||
# VERSION was removed in Pillow 6.0.0.
|
# VERSION was removed in Pillow 6.0.0.
|
||||||
# PILLOW_VERSION is deprecated and will be removed in a future release.
|
# PILLOW_VERSION was removed in Pillow 9.0.0.
|
||||||
# Use __version__ instead.
|
# Use __version__ instead.
|
||||||
from . import (
|
from . import ImageMode, TiffTags, UnidentifiedImageError, __version__, _plugins
|
||||||
ImageMode,
|
|
||||||
TiffTags,
|
|
||||||
UnidentifiedImageError,
|
|
||||||
__version__,
|
|
||||||
_plugins,
|
|
||||||
_raise_version_warning,
|
|
||||||
)
|
|
||||||
from ._binary import i32le
|
from ._binary import i32le
|
||||||
from ._util import deferred_error, isPath
|
from ._util import deferred_error, isPath
|
||||||
|
|
||||||
if sys.version_info >= (3, 7):
|
if sys.version_info >= (3, 7):
|
||||||
|
|
||||||
def __getattr__(name):
|
def __getattr__(name):
|
||||||
if name == "PILLOW_VERSION":
|
categories = {"NORMAL": 0, "SEQUENCE": 1, "CONTAINER": 2}
|
||||||
_raise_version_warning()
|
if name in categories:
|
||||||
return __version__
|
warnings.warn(
|
||||||
else:
|
"Image categories are deprecated and will be removed in Pillow 10 "
|
||||||
categories = {"NORMAL": 0, "SEQUENCE": 1, "CONTAINER": 2}
|
"(2023-01-02). Use is_animated instead.",
|
||||||
if name in categories:
|
DeprecationWarning,
|
||||||
warnings.warn(
|
stacklevel=2,
|
||||||
"Image categories are deprecated and will be removed in Pillow 10 "
|
)
|
||||||
"(2023-01-02). Use is_animated instead.",
|
return categories[name]
|
||||||
DeprecationWarning,
|
|
||||||
stacklevel=2,
|
|
||||||
)
|
|
||||||
return categories[name]
|
|
||||||
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
|
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
from . import PILLOW_VERSION
|
|
||||||
|
|
||||||
# Silence warning
|
|
||||||
assert PILLOW_VERSION
|
|
||||||
|
|
||||||
# categories
|
# categories
|
||||||
NORMAL = 0
|
NORMAL = 0
|
||||||
SEQUENCE = 1
|
SEQUENCE = 1
|
||||||
|
|
|
@ -19,66 +19,9 @@ import warnings
|
||||||
from . import _version
|
from . import _version
|
||||||
|
|
||||||
# VERSION was removed in Pillow 6.0.0.
|
# VERSION was removed in Pillow 6.0.0.
|
||||||
__version__ = _version.__version__
|
# PILLOW_VERSION was removed in Pillow 9.0.0.
|
||||||
|
|
||||||
|
|
||||||
# PILLOW_VERSION is deprecated and will be removed in a future release.
|
|
||||||
# Use __version__ instead.
|
# Use __version__ instead.
|
||||||
def _raise_version_warning():
|
__version__ = _version.__version__
|
||||||
warnings.warn(
|
|
||||||
"PILLOW_VERSION is deprecated and will be removed in Pillow 9 (2022-01-02). "
|
|
||||||
"Use __version__ instead.",
|
|
||||||
DeprecationWarning,
|
|
||||||
stacklevel=3,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if sys.version_info >= (3, 7):
|
|
||||||
|
|
||||||
def __getattr__(name):
|
|
||||||
if name == "PILLOW_VERSION":
|
|
||||||
_raise_version_warning()
|
|
||||||
return __version__
|
|
||||||
raise AttributeError(f"module '{__name__}' has no attribute '{name}'")
|
|
||||||
|
|
||||||
|
|
||||||
else:
|
|
||||||
|
|
||||||
class _Deprecated_Version(str):
|
|
||||||
def __str__(self):
|
|
||||||
_raise_version_warning()
|
|
||||||
return super().__str__()
|
|
||||||
|
|
||||||
def __getitem__(self, key):
|
|
||||||
_raise_version_warning()
|
|
||||||
return super().__getitem__(key)
|
|
||||||
|
|
||||||
def __eq__(self, other):
|
|
||||||
_raise_version_warning()
|
|
||||||
return super().__eq__(other)
|
|
||||||
|
|
||||||
def __ne__(self, other):
|
|
||||||
_raise_version_warning()
|
|
||||||
return super().__ne__(other)
|
|
||||||
|
|
||||||
def __gt__(self, other):
|
|
||||||
_raise_version_warning()
|
|
||||||
return super().__gt__(other)
|
|
||||||
|
|
||||||
def __lt__(self, other):
|
|
||||||
_raise_version_warning()
|
|
||||||
return super().__lt__(other)
|
|
||||||
|
|
||||||
def __ge__(self, other):
|
|
||||||
_raise_version_warning()
|
|
||||||
return super().__gt__(other)
|
|
||||||
|
|
||||||
def __le__(self, other):
|
|
||||||
_raise_version_warning()
|
|
||||||
return super().__lt__(other)
|
|
||||||
|
|
||||||
PILLOW_VERSION = _Deprecated_Version(__version__)
|
|
||||||
|
|
||||||
del _version
|
del _version
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user