mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Merge branch 'main' into build
This commit is contained in:
commit
87807727eb
|
@ -22,7 +22,8 @@ set -e
|
|||
if [[ $(uname) != CYGWIN* ]]; then
|
||||
sudo apt-get -qq install libfreetype6-dev liblcms2-dev python3-tk\
|
||||
ghostscript libffi-dev libjpeg-turbo-progs libopenjp2-7-dev\
|
||||
cmake meson imagemagick libharfbuzz-dev libfribidi-dev
|
||||
cmake meson imagemagick libharfbuzz-dev libfribidi-dev\
|
||||
sway wl-clipboard
|
||||
fi
|
||||
|
||||
python3 -m pip install --upgrade pip
|
||||
|
@ -41,7 +42,7 @@ if [[ $(uname) != CYGWIN* ]]; then
|
|||
if ! [ "$GHA_PYTHON_VERSION" == "3.12-dev" ]; then python3 -m pip install numpy ; fi
|
||||
|
||||
# PyQt6 doesn't support PyPy3
|
||||
if [[ $GHA_PYTHON_VERSION == 3.* ]]; then
|
||||
if [[ "$GHA_PYTHON_VERSION" != "3.12-dev" && $GHA_PYTHON_VERSION == 3.* ]]; then
|
||||
sudo apt-get -qq install libegl1 libxcb-cursor0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-shape0 libxkbcommon-x11-0
|
||||
python3 -m pip install pyqt6
|
||||
fi
|
||||
|
|
|
@ -13,10 +13,6 @@ indent_style = space
|
|||
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.rst]
|
||||
# Four-space indentation
|
||||
indent_size = 4
|
||||
|
||||
[*.yml]
|
||||
# Two-space indentation
|
||||
indent_size = 2
|
||||
|
|
4
.github/workflows/test-windows.yml
vendored
4
.github/workflows/test-windows.yml
vendored
|
@ -65,8 +65,8 @@ jobs:
|
|||
- name: Print build system information
|
||||
run: python3 .github/workflows/system-info.py
|
||||
|
||||
- name: python3 -m pip install wheel pytest pytest-cov pytest-timeout defusedxml
|
||||
run: python3 -m pip install wheel pytest pytest-cov pytest-timeout defusedxml
|
||||
- name: python3 -m pip install setuptools wheel pytest pytest-cov pytest-timeout defusedxml
|
||||
run: python3 -m pip install setuptools wheel pytest pytest-cov pytest-timeout defusedxml
|
||||
|
||||
- name: Install dependencies
|
||||
id: install
|
||||
|
|
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
|
@ -84,7 +84,9 @@ jobs:
|
|||
python3 -m pip install pytest-reverse
|
||||
fi
|
||||
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
|
||||
xvfb-run -s '-screen 0 1024x768x24' .ci/test.sh
|
||||
xvfb-run -s '-screen 0 1024x768x24' sway&
|
||||
export WAYLAND_DISPLAY=wayland-1
|
||||
.ci/test.sh
|
||||
else
|
||||
.ci/test.sh
|
||||
fi
|
||||
|
|
|
@ -4,9 +4,6 @@ repos:
|
|||
hooks:
|
||||
- id: black
|
||||
args: [--target-version=py38]
|
||||
# Only .py files, until https://github.com/psf/black/issues/402 resolved
|
||||
files: \.py$
|
||||
types: []
|
||||
|
||||
- repo: https://github.com/PyCQA/isort
|
||||
rev: 5.12.0
|
||||
|
|
|
@ -5,6 +5,9 @@ Changelog (Pillow)
|
|||
10.0.0 (unreleased)
|
||||
-------------------
|
||||
|
||||
- Improved wl-paste mimetype handling in ImageGrab #7094
|
||||
[rrcgat, radarhere]
|
||||
|
||||
- Added _repr_jpeg_() for IPython display_jpeg #7135
|
||||
[n3011, radarhere, nulano]
|
||||
|
||||
|
|
|
@ -98,3 +98,18 @@ $ms = new-object System.IO.MemoryStream(, $bytes)
|
|||
|
||||
im = ImageGrab.grabclipboard()
|
||||
assert_image_equal_tofile(im, "Tests/images/hopper.png")
|
||||
|
||||
@pytest.mark.skipif(
|
||||
(
|
||||
sys.platform != "linux"
|
||||
or not all(shutil.which(cmd) for cmd in ("wl-paste", "wl-copy"))
|
||||
),
|
||||
reason="Linux with wl-clipboard only",
|
||||
)
|
||||
@pytest.mark.parametrize("ext", ("gif", "png", "ico"))
|
||||
def test_grabclipboard_wl_clipboard(self, ext):
|
||||
image_path = "Tests/images/hopper." + ext
|
||||
with open(image_path, "rb") as fp:
|
||||
subprocess.call(["wl-copy"], stdin=fp)
|
||||
im = ImageGrab.grabclipboard()
|
||||
assert_image_equal_tofile(im, image_path)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
# Documentation: https://docs.codecov.io/docs/codecov-yaml
|
||||
# Documentation: https://docs.codecov.com/docs/codecov-yaml
|
||||
|
||||
codecov:
|
||||
# Avoid "Missing base report" due to committing CHANGES.rst with "[CI skip]"
|
||||
# https://github.com/codecov/support/issues/363
|
||||
# https://docs.codecov.io/docs/comparing-commits
|
||||
# https://docs.codecov.com/docs/comparing-commits
|
||||
allow_coverage_offsets: true
|
||||
|
||||
comment: false
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
from livereload.compiler import shell
|
||||
from livereload.task import Task
|
||||
|
||||
Task.add('*.rst', shell('make html'))
|
||||
Task.add('*/*.rst', shell('make html'))
|
||||
Task.add('Makefile', shell('make html'))
|
||||
Task.add('conf.py', shell('make html'))
|
||||
Task.add("*.rst", shell("make html"))
|
||||
Task.add("*/*.rst", shell("make html"))
|
||||
Task.add("Makefile", shell("make html"))
|
||||
Task.add("conf.py", shell("make html"))
|
||||
|
|
|
@ -22,11 +22,11 @@ import os
|
|||
import struct
|
||||
import sys
|
||||
|
||||
from PIL import Image, ImageFile, PngImagePlugin, features
|
||||
from . import Image, ImageFile, PngImagePlugin, features
|
||||
|
||||
enable_jpeg2k = features.check_codec("jpg_2000")
|
||||
if enable_jpeg2k:
|
||||
from PIL import Jpeg2KImagePlugin
|
||||
from . import Jpeg2KImagePlugin
|
||||
|
||||
MAGIC = b"icns"
|
||||
HEADERSIZE = 8
|
||||
|
|
|
@ -18,10 +18,10 @@
|
|||
import sys
|
||||
from enum import IntEnum
|
||||
|
||||
from PIL import Image
|
||||
from . import Image
|
||||
|
||||
try:
|
||||
from PIL import _imagingcms
|
||||
from . import _imagingcms
|
||||
except ImportError as ex:
|
||||
# Allow error import for doc purposes, but error out when accessing
|
||||
# anything in core.
|
||||
|
@ -271,7 +271,7 @@ def get_display_profile(handle=None):
|
|||
if sys.platform != "win32":
|
||||
return None
|
||||
|
||||
from PIL import ImageWin
|
||||
from . import ImageWin
|
||||
|
||||
if isinstance(handle, ImageWin.HDC):
|
||||
profile = core.get_display_profile_win32(handle, 1)
|
||||
|
|
|
@ -142,7 +142,18 @@ def grabclipboard():
|
|||
return None
|
||||
else:
|
||||
if shutil.which("wl-paste"):
|
||||
output = subprocess.check_output(["wl-paste", "-l"]).decode()
|
||||
mimetypes = output.splitlines()
|
||||
if "image/png" in mimetypes:
|
||||
mimetype = "image/png"
|
||||
elif mimetypes:
|
||||
mimetype = mimetypes[0]
|
||||
else:
|
||||
mimetype = None
|
||||
|
||||
args = ["wl-paste"]
|
||||
if mimetype:
|
||||
args.extend(["-t", mimetype])
|
||||
elif shutil.which("xclip"):
|
||||
args = ["xclip", "-selection", "clipboard", "-t", "image/png", "-o"]
|
||||
else:
|
||||
|
|
|
@ -17,7 +17,7 @@ import subprocess
|
|||
import sys
|
||||
from shlex import quote
|
||||
|
||||
from PIL import Image
|
||||
from . import Image
|
||||
|
||||
_viewers = []
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ import os
|
|||
import struct
|
||||
import sys
|
||||
|
||||
from PIL import Image, ImageFile
|
||||
from . import Image, ImageFile
|
||||
|
||||
|
||||
def isInt(f):
|
||||
|
@ -191,7 +191,7 @@ class SpiderImageFile(ImageFile.ImageFile):
|
|||
|
||||
# returns a ImageTk.PhotoImage object, after rescaling to 0..255
|
||||
def tkPhotoImage(self):
|
||||
from PIL import ImageTk
|
||||
from . import ImageTk
|
||||
|
||||
return ImageTk.PhotoImage(self.convert2byte(), palette=256)
|
||||
|
||||
|
|
|
@ -132,6 +132,27 @@ getfont(PyObject *self_, PyObject *args, PyObject *kw) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
#if PY_MAJOR_VERSION > 3 || PY_MINOR_VERSION > 11
|
||||
PyConfig config;
|
||||
PyConfig_InitPythonConfig(&config);
|
||||
if (!PyArg_ParseTupleAndKeywords(
|
||||
args,
|
||||
kw,
|
||||
"etf|nsy#n",
|
||||
kwlist,
|
||||
config.filesystem_encoding,
|
||||
&filename,
|
||||
&size,
|
||||
&index,
|
||||
&encoding,
|
||||
&font_bytes,
|
||||
&font_bytes_size,
|
||||
&layout_engine)) {
|
||||
PyConfig_Clear(&config);
|
||||
return NULL;
|
||||
}
|
||||
PyConfig_Clear(&config);
|
||||
#else
|
||||
if (!PyArg_ParseTupleAndKeywords(
|
||||
args,
|
||||
kw,
|
||||
|
@ -147,6 +168,7 @@ getfont(PyObject *self_, PyObject *args, PyObject *kw) {
|
|||
&layout_engine)) {
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
self = PyObject_New(FontObject, &Font_Type);
|
||||
if (!self) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user