mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-06-30 18:03:07 +03:00
Merge branch 'main' into type_hints
This commit is contained in:
commit
95255536cf
2
.github/workflows/release-drafter.yml
vendored
2
.github/workflows/release-drafter.yml
vendored
|
@ -23,6 +23,6 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
# Drafts your next release notes as pull requests are merged into "main"
|
# Drafts your next release notes as pull requests are merged into "main"
|
||||||
- uses: release-drafter/release-drafter@v5
|
- uses: release-drafter/release-drafter@v6
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
5
.github/workflows/test-cygwin.yml
vendored
5
.github/workflows/test-cygwin.yml
vendored
|
@ -49,7 +49,6 @@ jobs:
|
||||||
- name: Install Cygwin
|
- name: Install Cygwin
|
||||||
uses: egor-tensin/setup-cygwin@v4
|
uses: egor-tensin/setup-cygwin@v4
|
||||||
with:
|
with:
|
||||||
platform: x86_64
|
|
||||||
packages: >
|
packages: >
|
||||||
gcc-g++
|
gcc-g++
|
||||||
ghostscript
|
ghostscript
|
||||||
|
@ -81,7 +80,7 @@ jobs:
|
||||||
zlib-devel
|
zlib-devel
|
||||||
|
|
||||||
- name: Add Lapack to PATH
|
- name: Add Lapack to PATH
|
||||||
uses: egor-tensin/cleanup-path@v3
|
uses: egor-tensin/cleanup-path@v4
|
||||||
with:
|
with:
|
||||||
dirs: 'C:\cygwin\bin;C:\cygwin\lib\lapack'
|
dirs: 'C:\cygwin\bin;C:\cygwin\lib\lapack'
|
||||||
|
|
||||||
|
@ -142,7 +141,7 @@ jobs:
|
||||||
bash.exe .ci/after_success.sh
|
bash.exe .ci/after_success.sh
|
||||||
|
|
||||||
- name: Upload coverage
|
- name: Upload coverage
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v3.1.5
|
||||||
with:
|
with:
|
||||||
file: ./coverage.xml
|
file: ./coverage.xml
|
||||||
flags: GHA_Cygwin
|
flags: GHA_Cygwin
|
||||||
|
|
2
.github/workflows/test-docker.yml
vendored
2
.github/workflows/test-docker.yml
vendored
|
@ -101,7 +101,7 @@ jobs:
|
||||||
MATRIX_DOCKER: ${{ matrix.docker }}
|
MATRIX_DOCKER: ${{ matrix.docker }}
|
||||||
|
|
||||||
- name: Upload coverage
|
- name: Upload coverage
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v3.1.5
|
||||||
with:
|
with:
|
||||||
flags: GHA_Docker
|
flags: GHA_Docker
|
||||||
name: ${{ matrix.docker }}
|
name: ${{ matrix.docker }}
|
||||||
|
|
2
.github/workflows/test-mingw.yml
vendored
2
.github/workflows/test-mingw.yml
vendored
|
@ -82,7 +82,7 @@ jobs:
|
||||||
python3 -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests
|
python3 -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests
|
||||||
|
|
||||||
- name: Upload coverage
|
- name: Upload coverage
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v3.1.5
|
||||||
with:
|
with:
|
||||||
file: ./coverage.xml
|
file: ./coverage.xml
|
||||||
flags: GHA_Windows
|
flags: GHA_Windows
|
||||||
|
|
2
.github/workflows/test-windows.yml
vendored
2
.github/workflows/test-windows.yml
vendored
|
@ -202,7 +202,7 @@ jobs:
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
- name: Upload coverage
|
- name: Upload coverage
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v3.1.5
|
||||||
with:
|
with:
|
||||||
file: ./coverage.xml
|
file: ./coverage.xml
|
||||||
flags: GHA_Windows
|
flags: GHA_Windows
|
||||||
|
|
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
|
@ -149,7 +149,7 @@ jobs:
|
||||||
.ci/after_success.sh
|
.ci/after_success.sh
|
||||||
|
|
||||||
- name: Upload coverage
|
- name: Upload coverage
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v3.1.5
|
||||||
with:
|
with:
|
||||||
flags: ${{ matrix.os == 'ubuntu-latest' && 'GHA_Ubuntu' || 'GHA_macOS' }}
|
flags: ${{ matrix.os == 'ubuntu-latest' && 'GHA_Ubuntu' || 'GHA_macOS' }}
|
||||||
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
|
name: ${{ matrix.os }} Python ${{ matrix.python-version }}
|
||||||
|
|
6
.github/workflows/wheels-dependencies.sh
vendored
6
.github/workflows/wheels-dependencies.sh
vendored
|
@ -72,14 +72,12 @@ function build {
|
||||||
|
|
||||||
build_simple xcb-proto 1.16.0 https://xorg.freedesktop.org/archive/individual/proto
|
build_simple xcb-proto 1.16.0 https://xorg.freedesktop.org/archive/individual/proto
|
||||||
if [ -n "$IS_MACOS" ]; then
|
if [ -n "$IS_MACOS" ]; then
|
||||||
if [[ "$CIBW_ARCHS" == "arm64" ]]; then
|
|
||||||
build_simple xorgproto 2023.2 https://www.x.org/pub/individual/proto
|
build_simple xorgproto 2023.2 https://www.x.org/pub/individual/proto
|
||||||
build_simple libXau 1.0.11 https://www.x.org/pub/individual/lib
|
build_simple libXau 1.0.11 https://www.x.org/pub/individual/lib
|
||||||
build_simple libpthread-stubs 0.5 https://xcb.freedesktop.org/dist
|
build_simple libpthread-stubs 0.5 https://xcb.freedesktop.org/dist
|
||||||
if [ -f /Library/Frameworks/Python.framework/Versions/Current/share/pkgconfig/xcb-proto.pc ]; then
|
if [ -f /Library/Frameworks/Python.framework/Versions/Current/share/pkgconfig/xcb-proto.pc ]; then
|
||||||
cp /Library/Frameworks/Python.framework/Versions/Current/share/pkgconfig/xcb-proto.pc /Library/Frameworks/Python.framework/Versions/Current/lib/pkgconfig/xcb-proto.pc
|
cp /Library/Frameworks/Python.framework/Versions/Current/share/pkgconfig/xcb-proto.pc /Library/Frameworks/Python.framework/Versions/Current/lib/pkgconfig/xcb-proto.pc
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
sed s/\${pc_sysrootdir\}// /usr/local/share/pkgconfig/xcb-proto.pc > /usr/local/lib/pkgconfig/xcb-proto.pc
|
sed s/\${pc_sysrootdir\}// /usr/local/share/pkgconfig/xcb-proto.pc > /usr/local/lib/pkgconfig/xcb-proto.pc
|
||||||
fi
|
fi
|
||||||
|
@ -131,13 +129,13 @@ untar pillow-depends-main.zip
|
||||||
|
|
||||||
if [[ -n "$IS_MACOS" ]]; then
|
if [[ -n "$IS_MACOS" ]]; then
|
||||||
# webp, libtiff, libxcb cause a conflict with building webp, libtiff, libxcb
|
# webp, libtiff, libxcb cause a conflict with building webp, libtiff, libxcb
|
||||||
# libxdmcp causes an issue on macOS < 11
|
# libxau and libxdmcp cause an issue on macOS < 11
|
||||||
# if php is installed, brew tries to reinstall these after installing openblas
|
# if php is installed, brew tries to reinstall these after installing openblas
|
||||||
# remove cairo to fix building harfbuzz on arm64
|
# remove cairo to fix building harfbuzz on arm64
|
||||||
# remove lcms2 and libpng to fix building openjpeg on arm64
|
# remove lcms2 and libpng to fix building openjpeg on arm64
|
||||||
# remove zstd to avoid inclusion on x86_64
|
# remove zstd to avoid inclusion on x86_64
|
||||||
# curl from brew requires zstd, use system curl
|
# curl from brew requires zstd, use system curl
|
||||||
brew remove --ignore-dependencies webp libpng libtiff libxcb libxdmcp curl php cairo lcms2 ghostscript zstd
|
brew remove --ignore-dependencies webp libpng libtiff libxcb libxau libxdmcp curl php cairo lcms2 ghostscript zstd
|
||||||
|
|
||||||
brew install pkg-config
|
brew install pkg-config
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -5,6 +5,12 @@ Changelog (Pillow)
|
||||||
10.3.0 (unreleased)
|
10.3.0 (unreleased)
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
|
- Update wl-paste handling and return None for some errors in grabclipboard() on Linux #7745
|
||||||
|
[nik012003, radarhere]
|
||||||
|
|
||||||
|
- Remove execute bit from ``setup.py`` #7760
|
||||||
|
[hugovk]
|
||||||
|
|
||||||
- Do not support using test-image-results to upload images after test failures #7739
|
- Do not support using test-image-results to upload images after test failures #7739
|
||||||
[radarhere]
|
[radarhere]
|
||||||
|
|
||||||
|
|
|
@ -119,3 +119,15 @@ $ms = new-object System.IO.MemoryStream(, $bytes)
|
||||||
subprocess.call(["wl-copy"], stdin=fp)
|
subprocess.call(["wl-copy"], stdin=fp)
|
||||||
im = ImageGrab.grabclipboard()
|
im = ImageGrab.grabclipboard()
|
||||||
assert_image_equal_tofile(im, image_path)
|
assert_image_equal_tofile(im, image_path)
|
||||||
|
|
||||||
|
@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("arg", ("text", "--clear"))
|
||||||
|
def test_grabclipboard_wl_clipboard_errors(self, arg):
|
||||||
|
subprocess.call(["wl-copy", arg])
|
||||||
|
assert ImageGrab.grabclipboard() is None
|
||||||
|
|
|
@ -91,7 +91,7 @@ def _tilesort(t):
|
||||||
|
|
||||||
|
|
||||||
class _Tile(NamedTuple):
|
class _Tile(NamedTuple):
|
||||||
encoder_name: str
|
codec_name: str
|
||||||
extents: tuple[int, int, int, int]
|
extents: tuple[int, int, int, int]
|
||||||
offset: int
|
offset: int
|
||||||
args: tuple[Any, ...] | str | None
|
args: tuple[Any, ...] | str | None
|
||||||
|
|
|
@ -149,18 +149,7 @@ def grabclipboard():
|
||||||
session_type = None
|
session_type = None
|
||||||
|
|
||||||
if shutil.which("wl-paste") and session_type in ("wayland", None):
|
if shutil.which("wl-paste") and session_type in ("wayland", None):
|
||||||
output = subprocess.check_output(["wl-paste", "-l"]).decode()
|
args = ["wl-paste", "-t", "image"]
|
||||||
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") and session_type in ("x11", None):
|
elif shutil.which("xclip") and session_type in ("x11", None):
|
||||||
args = ["xclip", "-selection", "clipboard", "-t", "image/png", "-o"]
|
args = ["xclip", "-selection", "clipboard", "-t", "image/png", "-o"]
|
||||||
else:
|
else:
|
||||||
|
@ -168,10 +157,29 @@ def grabclipboard():
|
||||||
raise NotImplementedError(msg)
|
raise NotImplementedError(msg)
|
||||||
|
|
||||||
p = subprocess.run(args, capture_output=True)
|
p = subprocess.run(args, capture_output=True)
|
||||||
|
if p.returncode != 0:
|
||||||
err = p.stderr
|
err = p.stderr
|
||||||
|
for silent_error in [
|
||||||
|
# wl-paste, when the clipboard is empty
|
||||||
|
b"Nothing is copied",
|
||||||
|
# Ubuntu/Debian wl-paste, when the clipboard is empty
|
||||||
|
b"No selection",
|
||||||
|
# Ubuntu/Debian wl-paste, when an image isn't available
|
||||||
|
b"No suitable type of content copied",
|
||||||
|
# wl-paste or Ubuntu/Debian xclip, when an image isn't available
|
||||||
|
b" not available",
|
||||||
|
# xclip, when an image isn't available
|
||||||
|
b"cannot convert ",
|
||||||
|
# xclip, when the clipboard isn't initialized
|
||||||
|
b"xclip: Error: There is no owner for the ",
|
||||||
|
]:
|
||||||
|
if silent_error in err:
|
||||||
|
return None
|
||||||
|
msg = f"{args[0]} error"
|
||||||
if err:
|
if err:
|
||||||
msg = f"{args[0]} error: {err.strip().decode()}"
|
msg += f": {err.strip().decode()}"
|
||||||
raise ChildProcessError(msg)
|
raise ChildProcessError(msg)
|
||||||
|
|
||||||
data = io.BytesIO(p.stdout)
|
data = io.BytesIO(p.stdout)
|
||||||
im = Image.open(data)
|
im = Image.open(data)
|
||||||
im.load()
|
im.load()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user