mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 18:56:17 +03:00
Merge branch 'main' into rm-svn
This commit is contained in:
commit
e922714bbf
|
@ -9,7 +9,7 @@ repos:
|
|||
types: []
|
||||
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.11.4
|
||||
rev: 5.12.0
|
||||
hooks:
|
||||
- id: isort
|
||||
|
||||
|
@ -26,7 +26,7 @@ repos:
|
|||
- id: yesqa
|
||||
|
||||
- repo: https://github.com/Lucas-C/pre-commit-hooks
|
||||
rev: v1.3.1
|
||||
rev: v1.4.2
|
||||
hooks:
|
||||
- id: remove-tabs
|
||||
exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.opt$)
|
||||
|
@ -39,7 +39,7 @@ repos:
|
|||
[flake8-2020, flake8-errmsg, flake8-implicit-str-concat]
|
||||
|
||||
- repo: https://github.com/pre-commit/pygrep-hooks
|
||||
rev: v1.9.0
|
||||
rev: v1.10.0
|
||||
hooks:
|
||||
- id: python-check-blanket-noqa
|
||||
- id: rst-backticks
|
||||
|
@ -57,7 +57,7 @@ repos:
|
|||
- id: sphinx-lint
|
||||
|
||||
- repo: https://github.com/tox-dev/tox-ini-fmt
|
||||
rev: 0.5.2
|
||||
rev: 0.6.1
|
||||
hooks:
|
||||
- id: tox-ini-fmt
|
||||
|
||||
|
|
|
@ -5,6 +5,9 @@ Changelog (Pillow)
|
|||
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
|
||||
[radarhere]
|
||||
|
||||
|
|
|
@ -398,6 +398,17 @@ class TestImage:
|
|||
with pytest.raises(ValueError):
|
||||
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):
|
||||
# Arrange
|
||||
Image._initialized = 0
|
||||
|
|
|
@ -6,7 +6,7 @@ with warnings.catch_warnings():
|
|||
warnings.simplefilter("ignore", category=DeprecationWarning)
|
||||
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:
|
||||
from PIL.ImageQt import QPixmap
|
||||
|
@ -48,7 +48,7 @@ if ImageQt.qt_is_installed:
|
|||
def roundtrip(expected):
|
||||
result = ImageQt.fromqpixmap(ImageQt.toqpixmap(expected))
|
||||
# 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")
|
||||
|
|
26
setup.py
26
setup.py
|
@ -263,18 +263,18 @@ def _pkg_config(name):
|
|||
if not DEBUG:
|
||||
command_libs.append("--silence-errors")
|
||||
command_cflags.append("--silence-errors")
|
||||
libs = (
|
||||
libs = re.split(
|
||||
r"(^|\s+)-L",
|
||||
subprocess.check_output(command_libs, stderr=stderr)
|
||||
.decode("utf8")
|
||||
.strip()
|
||||
.replace("-L", "")
|
||||
)
|
||||
cflags = (
|
||||
subprocess.check_output(command_cflags)
|
||||
.strip(),
|
||||
)[::2][1:]
|
||||
cflags = re.split(
|
||||
r"(^|\s+)-I",
|
||||
subprocess.check_output(command_cflags, stderr=stderr)
|
||||
.decode("utf8")
|
||||
.strip()
|
||||
.replace("-I", "")
|
||||
)
|
||||
.strip(),
|
||||
)[::2][1:]
|
||||
return libs, cflags
|
||||
except Exception:
|
||||
pass
|
||||
|
@ -473,8 +473,12 @@ class pil_build_ext(build_ext):
|
|||
else:
|
||||
lib_root = include_root = root
|
||||
|
||||
_add_directory(library_dirs, lib_root)
|
||||
_add_directory(include_dirs, include_root)
|
||||
if lib_root is not None:
|
||||
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
|
||||
for k in ("CFLAGS", "CPPFLAGS", "LDFLAGS"):
|
||||
|
|
|
@ -3406,7 +3406,8 @@ def register_open(id, factory, accept=None):
|
|||
reject images having another format.
|
||||
"""
|
||||
id = id.upper()
|
||||
ID.append(id)
|
||||
if id not in ID:
|
||||
ID.append(id)
|
||||
OPEN[id] = factory, accept
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user