mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-14 11:26:27 +03:00
Merge branch 'main' into rm-svn
This commit is contained in:
commit
e922714bbf
|
@ -9,7 +9,7 @@ repos:
|
||||||
types: []
|
types: []
|
||||||
|
|
||||||
- repo: https://github.com/PyCQA/isort
|
- repo: https://github.com/PyCQA/isort
|
||||||
rev: 5.11.4
|
rev: 5.12.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: isort
|
- id: isort
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ repos:
|
||||||
- id: yesqa
|
- id: yesqa
|
||||||
|
|
||||||
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
||||||
rev: v1.3.1
|
rev: v1.4.2
|
||||||
hooks:
|
hooks:
|
||||||
- id: remove-tabs
|
- id: remove-tabs
|
||||||
exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.opt$)
|
exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.opt$)
|
||||||
|
@ -39,7 +39,7 @@ repos:
|
||||||
[flake8-2020, flake8-errmsg, flake8-implicit-str-concat]
|
[flake8-2020, flake8-errmsg, flake8-implicit-str-concat]
|
||||||
|
|
||||||
- repo: https://github.com/pre-commit/pygrep-hooks
|
- repo: https://github.com/pre-commit/pygrep-hooks
|
||||||
rev: v1.9.0
|
rev: v1.10.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: python-check-blanket-noqa
|
- id: python-check-blanket-noqa
|
||||||
- id: rst-backticks
|
- id: rst-backticks
|
||||||
|
@ -57,7 +57,7 @@ repos:
|
||||||
- id: sphinx-lint
|
- id: sphinx-lint
|
||||||
|
|
||||||
- repo: https://github.com/tox-dev/tox-ini-fmt
|
- repo: https://github.com/tox-dev/tox-ini-fmt
|
||||||
rev: 0.5.2
|
rev: 0.6.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: tox-ini-fmt
|
- id: tox-ini-fmt
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,9 @@ Changelog (Pillow)
|
||||||
9.5.0 (unreleased)
|
9.5.0 (unreleased)
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
- Handle more than one directory returned by pkg-config #6896
|
||||||
|
[sebastic, radarhere]
|
||||||
|
|
||||||
- Do not retry past formats when loading all formats for the first time #6902
|
- Do not retry past formats when loading all formats for the first time #6902
|
||||||
[radarhere]
|
[radarhere]
|
||||||
|
|
||||||
|
|
|
@ -398,6 +398,17 @@ class TestImage:
|
||||||
with pytest.raises(ValueError):
|
with pytest.raises(ValueError):
|
||||||
source.alpha_composite(over, (0, 0), (0, -1))
|
source.alpha_composite(over, (0, 0), (0, -1))
|
||||||
|
|
||||||
|
def test_register_open_duplicates(self):
|
||||||
|
# Arrange
|
||||||
|
factory, accept = Image.OPEN["JPEG"]
|
||||||
|
id_length = len(Image.ID)
|
||||||
|
|
||||||
|
# Act
|
||||||
|
Image.register_open("JPEG", factory, accept)
|
||||||
|
|
||||||
|
# Assert
|
||||||
|
assert len(Image.ID) == id_length
|
||||||
|
|
||||||
def test_registered_extensions_uninitialized(self):
|
def test_registered_extensions_uninitialized(self):
|
||||||
# Arrange
|
# Arrange
|
||||||
Image._initialized = 0
|
Image._initialized = 0
|
||||||
|
|
|
@ -6,7 +6,7 @@ with warnings.catch_warnings():
|
||||||
warnings.simplefilter("ignore", category=DeprecationWarning)
|
warnings.simplefilter("ignore", category=DeprecationWarning)
|
||||||
from PIL import ImageQt
|
from PIL import ImageQt
|
||||||
|
|
||||||
from .helper import assert_image_equal, assert_image_equal_tofile, hopper
|
from .helper import assert_image_equal_tofile, assert_image_similar, hopper
|
||||||
|
|
||||||
if ImageQt.qt_is_installed:
|
if ImageQt.qt_is_installed:
|
||||||
from PIL.ImageQt import QPixmap
|
from PIL.ImageQt import QPixmap
|
||||||
|
@ -48,7 +48,7 @@ if ImageQt.qt_is_installed:
|
||||||
def roundtrip(expected):
|
def roundtrip(expected):
|
||||||
result = ImageQt.fromqpixmap(ImageQt.toqpixmap(expected))
|
result = ImageQt.fromqpixmap(ImageQt.toqpixmap(expected))
|
||||||
# Qt saves all pixmaps as rgb
|
# Qt saves all pixmaps as rgb
|
||||||
assert_image_equal(result, expected.convert("RGB"))
|
assert_image_similar(result, expected.convert("RGB"), 0.3)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.skipif(not ImageQt.qt_is_installed, reason="Qt bindings are not installed")
|
@pytest.mark.skipif(not ImageQt.qt_is_installed, reason="Qt bindings are not installed")
|
||||||
|
|
26
setup.py
26
setup.py
|
@ -263,18 +263,18 @@ def _pkg_config(name):
|
||||||
if not DEBUG:
|
if not DEBUG:
|
||||||
command_libs.append("--silence-errors")
|
command_libs.append("--silence-errors")
|
||||||
command_cflags.append("--silence-errors")
|
command_cflags.append("--silence-errors")
|
||||||
libs = (
|
libs = re.split(
|
||||||
|
r"(^|\s+)-L",
|
||||||
subprocess.check_output(command_libs, stderr=stderr)
|
subprocess.check_output(command_libs, stderr=stderr)
|
||||||
.decode("utf8")
|
.decode("utf8")
|
||||||
.strip()
|
.strip(),
|
||||||
.replace("-L", "")
|
)[::2][1:]
|
||||||
)
|
cflags = re.split(
|
||||||
cflags = (
|
r"(^|\s+)-I",
|
||||||
subprocess.check_output(command_cflags)
|
subprocess.check_output(command_cflags, stderr=stderr)
|
||||||
.decode("utf8")
|
.decode("utf8")
|
||||||
.strip()
|
.strip(),
|
||||||
.replace("-I", "")
|
)[::2][1:]
|
||||||
)
|
|
||||||
return libs, cflags
|
return libs, cflags
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
@ -473,8 +473,12 @@ class pil_build_ext(build_ext):
|
||||||
else:
|
else:
|
||||||
lib_root = include_root = root
|
lib_root = include_root = root
|
||||||
|
|
||||||
_add_directory(library_dirs, lib_root)
|
if lib_root is not None:
|
||||||
_add_directory(include_dirs, include_root)
|
for lib_dir in lib_root:
|
||||||
|
_add_directory(library_dirs, lib_dir)
|
||||||
|
if include_root is not None:
|
||||||
|
for include_dir in include_root:
|
||||||
|
_add_directory(include_dirs, include_dir)
|
||||||
|
|
||||||
# respect CFLAGS/CPPFLAGS/LDFLAGS
|
# respect CFLAGS/CPPFLAGS/LDFLAGS
|
||||||
for k in ("CFLAGS", "CPPFLAGS", "LDFLAGS"):
|
for k in ("CFLAGS", "CPPFLAGS", "LDFLAGS"):
|
||||||
|
|
|
@ -3406,7 +3406,8 @@ def register_open(id, factory, accept=None):
|
||||||
reject images having another format.
|
reject images having another format.
|
||||||
"""
|
"""
|
||||||
id = id.upper()
|
id = id.upper()
|
||||||
ID.append(id)
|
if id not in ID:
|
||||||
|
ID.append(id)
|
||||||
OPEN[id] = factory, accept
|
OPEN[id] = factory, accept
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user