diff --git a/.appveyor.yml b/.appveyor.yml
index 60132a9a3..cc4d56d0b 100644
--- a/.appveyor.yml
+++ b/.appveyor.yml
@@ -21,13 +21,11 @@ environment:
install:
- '%PYTHON%\%EXECUTABLE% --version'
- '%PYTHON%\%EXECUTABLE% -m pip install --upgrade pip'
-- curl -fsSL -o pillow-depends.zip https://github.com/python-pillow/pillow-depends/archive/main.zip
- curl -fsSL -o pillow-test-images.zip https://github.com/python-pillow/test-images/archive/main.zip
-- 7z x pillow-depends.zip -oc:\
- 7z x pillow-test-images.zip -oc:\
-- mv c:\pillow-depends-main c:\pillow-depends
- xcopy /S /Y c:\test-images-main\* c:\pillow\tests\images
-- 7z x ..\pillow-depends\nasm-2.16.01-win64.zip -oc:\
+- curl -fsSL -o nasm-win64.zip https://raw.githubusercontent.com/python-pillow/pillow-depends/main/nasm-2.16.01-win64.zip
+- 7z x nasm-win64.zip -oc:\
- choco install ghostscript --version=10.0.0.20230317
- path c:\nasm-2.16.01;C:\Program Files\gs\gs10.00.0\bin;%PATH%
- cd c:\pillow\winbuild\
diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml
index 9e2fdc096..8fc7bd379 100644
--- a/.github/workflows/release-drafter.yml
+++ b/.github/workflows/release-drafter.yml
@@ -10,7 +10,7 @@ on:
permissions:
contents: read
-concurrency:
+concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml
index 24b8f85d1..31f63e1c6 100644
--- a/.github/workflows/stale.yml
+++ b/.github/workflows/stale.yml
@@ -8,7 +8,7 @@ on:
permissions:
issues: write
-concurrency:
+concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
diff --git a/.github/workflows/test-cygwin.yml b/.github/workflows/test-cygwin.yml
index 5071e5bd4..5caa9faa4 100644
--- a/.github/workflows/test-cygwin.yml
+++ b/.github/workflows/test-cygwin.yml
@@ -4,11 +4,19 @@ on:
push:
paths-ignore:
- ".github/workflows/docs.yml"
+ - ".github/workflows/wheels*"
+ - ".gitmodules"
+ - ".travis.yml"
- "docs/**"
+ - "wheels/**"
pull_request:
paths-ignore:
- ".github/workflows/docs.yml"
+ - ".github/workflows/wheels*"
+ - ".gitmodules"
+ - ".travis.yml"
- "docs/**"
+ - "wheels/**"
workflow_dispatch:
permissions:
diff --git a/.github/workflows/test-docker.yml b/.github/workflows/test-docker.yml
index a0c7444c6..98a5de158 100644
--- a/.github/workflows/test-docker.yml
+++ b/.github/workflows/test-docker.yml
@@ -4,11 +4,19 @@ on:
push:
paths-ignore:
- ".github/workflows/docs.yml"
+ - ".github/workflows/wheels*"
+ - ".gitmodules"
+ - ".travis.yml"
- "docs/**"
+ - "wheels/**"
pull_request:
paths-ignore:
- ".github/workflows/docs.yml"
+ - ".github/workflows/wheels*"
+ - ".gitmodules"
+ - ".travis.yml"
- "docs/**"
+ - "wheels/**"
workflow_dispatch:
permissions:
diff --git a/.github/workflows/test-mingw.yml b/.github/workflows/test-mingw.yml
index 08dfb9a2d..76e02ae92 100644
--- a/.github/workflows/test-mingw.yml
+++ b/.github/workflows/test-mingw.yml
@@ -4,11 +4,19 @@ on:
push:
paths-ignore:
- ".github/workflows/docs.yml"
+ - ".github/workflows/wheels*"
+ - ".gitmodules"
+ - ".travis.yml"
- "docs/**"
+ - "wheels/**"
pull_request:
paths-ignore:
- ".github/workflows/docs.yml"
+ - ".github/workflows/wheels*"
+ - ".gitmodules"
+ - ".travis.yml"
- "docs/**"
+ - "wheels/**"
workflow_dispatch:
permissions:
diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml
index ae3cc6127..3d7ec8e67 100644
--- a/.github/workflows/test-windows.yml
+++ b/.github/workflows/test-windows.yml
@@ -4,11 +4,19 @@ on:
push:
paths-ignore:
- ".github/workflows/docs.yml"
+ - ".github/workflows/wheels*"
+ - ".gitmodules"
+ - ".travis.yml"
- "docs/**"
+ - "wheels/**"
pull_request:
paths-ignore:
- ".github/workflows/docs.yml"
+ - ".github/workflows/wheels*"
+ - ".gitmodules"
+ - ".travis.yml"
- "docs/**"
+ - "wheels/**"
workflow_dispatch:
permissions:
@@ -24,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- python-version: ["pypy3.10", "pypy3.9", "3.8", "3.9", "3.10", "3.11", "3.12-dev"]
+ python-version: ["pypy3.10", "pypy3.9", "3.8", "3.9", "3.10", "3.11", "3.12"]
timeout-minutes: 30
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 2f43f4b55..926fe2de6 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -4,11 +4,19 @@ on:
push:
paths-ignore:
- ".github/workflows/docs.yml"
+ - ".github/workflows/wheels*"
+ - ".gitmodules"
+ - ".travis.yml"
- "docs/**"
+ - "wheels/**"
pull_request:
paths-ignore:
- ".github/workflows/docs.yml"
+ - ".github/workflows/wheels*"
+ - ".gitmodules"
+ - ".travis.yml"
- "docs/**"
+ - "wheels/**"
workflow_dispatch:
permissions:
@@ -31,7 +39,7 @@ jobs:
python-version: [
"pypy3.10",
"pypy3.9",
- "3.12-dev",
+ "3.12",
"3.11",
"3.10",
"3.9",
diff --git a/.github/workflows/wheels-build.sh b/.github/workflows/wheels-build.sh
new file mode 100755
index 000000000..0aeec6b96
--- /dev/null
+++ b/.github/workflows/wheels-build.sh
@@ -0,0 +1,40 @@
+#!/bin/bash
+
+if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
+ # webp, zstd, xz, libtiff, libxcb cause a conflict with building webp, libtiff, libxcb
+ # libxdmcp causes an issue on macOS < 11
+ # curl from brew requires zstd, use system curl
+ # if php is installed, brew tries to reinstall these after installing openblas
+ # remove lcms2 and libpng to fix building openjpeg on arm64
+ brew remove --ignore-dependencies webp zstd xz libpng libtiff libxcb libxdmcp curl php lcms2 ghostscript
+
+ brew install pkg-config
+
+ if [[ "$PLAT" == "arm64" ]]; then
+ export MACOSX_DEPLOYMENT_TARGET="11.0"
+ else
+ export MACOSX_DEPLOYMENT_TARGET="10.10"
+ fi
+fi
+
+if [[ "$MB_PYTHON_VERSION" == pypy3* ]]; then
+ MB_PYTHON_OSX_VER="10.9"
+fi
+
+echo "::group::Install a virtualenv"
+ source wheels/multibuild/common_utils.sh
+ source wheels/multibuild/travis_steps.sh
+ python3 -m pip install virtualenv
+ before_install
+echo "::endgroup::"
+
+echo "::group::Build wheel"
+ build_wheel
+ ls -l "${GITHUB_WORKSPACE}/${WHEEL_SDIR}/"
+echo "::endgroup::"
+
+if [[ $MACOSX_DEPLOYMENT_TARGET != "11.0" ]]; then
+ echo "::group::Test wheel"
+ install_run
+ echo "::endgroup::"
+fi
diff --git a/.github/workflows/wheels-linux.yml b/.github/workflows/wheels-linux.yml
new file mode 100644
index 000000000..8b2d9d451
--- /dev/null
+++ b/.github/workflows/wheels-linux.yml
@@ -0,0 +1,69 @@
+name: Build Linux wheels
+
+on:
+ workflow_call:
+ inputs:
+ artifacts-name:
+ required: true
+ type: string
+
+env:
+ CONFIG_PATH: "wheels/config.sh"
+ REPO_DIR: "."
+ TEST_DEPENDS: "pytest pytest-timeout"
+
+jobs:
+ build:
+ name: ${{ matrix.python }} ${{ matrix.mb-ml-libc }}${{ matrix.mb-ml-ver }}
+ runs-on: "ubuntu-latest"
+ strategy:
+ fail-fast: false
+ matrix:
+ python: [
+ "pypy3.9-7.3.13",
+ "pypy3.10-7.3.13",
+ "3.8",
+ "3.9",
+ "3.10",
+ "3.11",
+ "3.12",
+ ]
+ mb-ml-libc: [ "manylinux" ]
+ mb-ml-ver: [ 2014, "_2_28" ]
+ include:
+ - python: "3.8"
+ mb-ml-libc: "musllinux"
+ mb-ml-ver: "_1_1"
+ - python: "3.9"
+ mb-ml-libc: "musllinux"
+ mb-ml-ver: "_1_1"
+ - python: "3.10"
+ mb-ml-libc: "musllinux"
+ mb-ml-ver: "_1_1"
+ - python: "3.11"
+ mb-ml-libc: "musllinux"
+ mb-ml-ver: "_1_1"
+ - python: "3.12"
+ mb-ml-libc: "musllinux"
+ mb-ml-ver: "_1_1"
+ env:
+ MB_PYTHON_VERSION: ${{ matrix.python }}
+ MB_ML_LIBC: ${{ matrix.mb-ml-libc }}
+ MB_ML_VER: ${{ matrix.mb-ml-ver }}
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: true
+ - uses: actions/setup-python@v4
+ with:
+ python-version: "3.x"
+ - name: Build Wheel
+ run: .github/workflows/wheels-build.sh
+ - uses: actions/upload-artifact@v3
+ with:
+ name: ${{ inputs.artifacts-name }}
+ path: wheelhouse/*.whl
+ # Uncomment to get SSH access for testing
+ # - name: Setup tmate session
+ # if: failure()
+ # uses: mxschmitt/action-tmate@v3
diff --git a/.github/workflows/wheels-macos.yml b/.github/workflows/wheels-macos.yml
new file mode 100644
index 000000000..c51abf39a
--- /dev/null
+++ b/.github/workflows/wheels-macos.yml
@@ -0,0 +1,57 @@
+name: Build macOS wheels
+
+on:
+ workflow_call:
+ inputs:
+ artifacts-name:
+ required: true
+ type: string
+
+env:
+ CONFIG_PATH: "wheels/config.sh"
+ REPO_DIR: "."
+ TEST_DEPENDS: "pytest pytest-timeout"
+
+jobs:
+ build:
+ name: ${{ matrix.python }} ${{ matrix.platform }}
+ runs-on: "macos-latest"
+ strategy:
+ fail-fast: false
+ matrix:
+ python: [
+ "pypy3.9-7.3.13",
+ "pypy3.10-7.3.13",
+ "3.8",
+ "3.9",
+ "3.10",
+ "3.11",
+ "3.12",
+ ]
+ platform: [ "x86_64", "arm64" ]
+ exclude:
+ - python: "pypy3.9-7.3.13"
+ platform: "arm64"
+ - python: "pypy3.10-7.3.13"
+ platform: "arm64"
+ env:
+ PLAT: ${{ matrix.platform }}
+ MB_PYTHON_VERSION: ${{ matrix.python }}
+ TRAVIS_OS_NAME: "osx"
+ steps:
+ - uses: actions/checkout@v4
+ with:
+ submodules: true
+ - uses: actions/setup-python@v4
+ with:
+ python-version: "3.x"
+ - name: Build Wheel
+ run: .github/workflows/wheels-build.sh
+ - uses: actions/upload-artifact@v3
+ with:
+ name: ${{ inputs.artifacts-name }}
+ path: wheelhouse/*.whl
+ # Uncomment to get SSH access for testing
+ # - name: Setup tmate session
+ # if: failure()
+ # uses: mxschmitt/action-tmate@v3
diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml
new file mode 100644
index 000000000..4381a9856
--- /dev/null
+++ b/.github/workflows/wheels.yml
@@ -0,0 +1,42 @@
+name: Wheels
+
+on:
+ push:
+ paths:
+ - ".github/workflows/wheels*.yml"
+ - "wheels/*"
+ tags:
+ - "*"
+ pull_request:
+ paths:
+ - ".github/workflows/wheels*.yml"
+ - "wheels/*"
+ workflow_dispatch:
+
+permissions:
+ contents: read
+
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: true
+
+jobs:
+ macos:
+ uses: ./.github/workflows/wheels-macos.yml
+ with:
+ artifacts-name: "wheels"
+
+ linux:
+ uses: ./.github/workflows/wheels-linux.yml
+ with:
+ artifacts-name: "wheels"
+
+ success:
+ permissions:
+ contents: none
+ needs: [macos, linux]
+ runs-on: ubuntu-latest
+ name: Wheels Successful
+ steps:
+ - name: Success
+ run: echo Wheels Successful
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 000000000..80d5ab16c
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "multibuild"]
+ path = wheels/multibuild
+ url = https://github.com/multi-build/multibuild.git
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 460661166..a8c7696df 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,6 +1,12 @@
repos:
- - repo: https://github.com/psf/black
- rev: 23.7.0
+ - repo: https://github.com/asottile/pyupgrade
+ rev: v3.13.0
+ hooks:
+ - id: pyupgrade
+ args: [--py38-plus]
+
+ - repo: https://github.com/psf/black-pre-commit-mirror
+ rev: 23.9.1
hooks:
- id: black
args: [--target-version=py38]
@@ -33,7 +39,7 @@ repos:
hooks:
- id: flake8
additional_dependencies:
- [flake8-2020, flake8-errmsg, flake8-implicit-str-concat]
+ [flake8-2020, flake8-errmsg, flake8-implicit-str-concat, flake8-logging]
- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
@@ -44,10 +50,15 @@ repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
+ - id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-json
- id: check-toml
- id: check-yaml
+ - id: end-of-file-fixer
+ exclude: ^Tests/images/
+ - id: trailing-whitespace
+ exclude: ^.github/.*TEMPLATE|^Tests/(fonts|images)/
- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v0.6.8
@@ -55,7 +66,7 @@ repos:
- id: sphinx-lint
- repo: https://github.com/tox-dev/pyproject-fmt
- rev: 1.1.0
+ rev: 1.2.0
hooks:
- id: pyproject-fmt
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 000000000..4c0320e87
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,135 @@
+if: tag IS present
+
+env:
+ global:
+ - CONFIG_PATH=wheels/config.sh
+ - REPO_DIR=.
+ - PLAT=aarch64
+ - TEST_DEPENDS=pytest-timeout
+
+language: python
+# Default Python version is usually 3.6
+python: "3.11"
+dist: focal
+services: docker
+
+jobs:
+ include:
+ - name: "3.8 Focal manylinux2014 aarch64"
+ os: linux
+ arch: arm64
+ env:
+ - MB_ML_VER=2014
+ - MB_PYTHON_VERSION=3.8
+ - name: "3.8 Focal manylinux_2_28 aarch64"
+ os: linux
+ arch: arm64
+ env:
+ - MB_ML_VER="_2_28"
+ - MB_PYTHON_VERSION=3.8
+ - name: "3.8 musllinux_1_1 aarch64"
+ os: linux
+ arch: arm64
+ env:
+ - MB_ML_VER="_1_1"
+ - MB_ML_LIBC="musllinux"
+ - MB_PYTHON_VERSION=3.8
+ - name: "3.9 Focal manylinux2014 aarch64"
+ os: linux
+ arch: arm64
+ env:
+ - MB_ML_VER=2014
+ - MB_PYTHON_VERSION=3.9
+ - name: "3.9 Focal manylinux_2_28 aarch64"
+ os: linux
+ arch: arm64
+ env:
+ - MB_ML_VER="_2_28"
+ - MB_PYTHON_VERSION=3.9
+ - name: "3.9 musllinux_1_1 aarch64"
+ os: linux
+ arch: arm64
+ env:
+ - MB_ML_VER="_1_1"
+ - MB_ML_LIBC="musllinux"
+ - MB_PYTHON_VERSION=3.9
+ - name: "3.10 Focal manylinux2014 aarch64"
+ os: linux
+ arch: arm64
+ env:
+ - MB_ML_VER=2014
+ - MB_PYTHON_VERSION=3.10
+ - name: "3.10 Focal manylinux_2_28 aarch64"
+ os: linux
+ arch: arm64
+ env:
+ - MB_ML_VER="_2_28"
+ - MB_PYTHON_VERSION=3.10
+ - name: "3.10 musllinux_1_1 aarch64"
+ os: linux
+ arch: arm64
+ env:
+ - MB_ML_VER="_1_1"
+ - MB_ML_LIBC="musllinux"
+ - MB_PYTHON_VERSION=3.10
+ - name: "3.11 Focal manylinux_2_28 aarch64"
+ os: linux
+ arch: arm64
+ env:
+ - MB_ML_VER=2014
+ - MB_PYTHON_VERSION=3.11
+ - name: "3.11 Focal manylinux_2_28 aarch64"
+ os: linux
+ arch: arm64
+ env:
+ - MB_ML_VER="_2_28"
+ - MB_PYTHON_VERSION=3.11
+ - name: "3.11 musllinux_1_1 aarch64"
+ os: linux
+ arch: arm64
+ env:
+ - MB_ML_VER="_1_1"
+ - MB_ML_LIBC="musllinux"
+ - MB_PYTHON_VERSION=3.11
+ - name: "3.12 Focal manylinux_2_28 aarch64"
+ os: linux
+ arch: arm64
+ env:
+ - MB_ML_VER=2014
+ - MB_PYTHON_VERSION=3.12
+ - name: "3.12 Focal manylinux_2_28 aarch64"
+ os: linux
+ arch: arm64
+ env:
+ - MB_ML_VER="_2_28"
+ - MB_PYTHON_VERSION=3.12
+ - name: "3.12 musllinux_1_1 aarch64"
+ os: linux
+ arch: arm64
+ env:
+ - MB_ML_VER="_1_1"
+ - MB_ML_LIBC="musllinux"
+ - MB_PYTHON_VERSION=3.12
+
+before_install:
+ - source wheels/multibuild/common_utils.sh
+ - source wheels/multibuild/travis_steps.sh
+ - before_install
+
+install:
+ - build_multilinux aarch64 build_wheel
+ - ls -l "${TRAVIS_BUILD_DIR}/${WHEEL_SDIR}/"
+
+script:
+ - install_run
+
+# Upload wheels to GitHub Releases
+deploy:
+ provider: releases
+ api_key: $GITHUB_RELEASE_TOKEN
+ file_glob: true
+ file: "${TRAVIS_BUILD_DIR}/${WHEEL_SDIR}/*.whl"
+ on:
+ repo: python-pillow/Pillow
+ tags: true
+ skip_cleanup: true
diff --git a/CHANGES.rst b/CHANGES.rst
index d1dce8e0d..c77a47b9a 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -5,6 +5,30 @@ Changelog (Pillow)
10.1.0 (unreleased)
-------------------
+- Corrected drawing I;16 points and writing I;16 text #7257
+ [radarhere]
+
+- Set blue channel to 128 for BC5S #7413
+ [radarhere]
+
+- Increase flexibility when reading IPTC fields #7319
+ [radarhere]
+
+- Set C palette to be empty by default #7289
+ [radarhere]
+
+- Added gs_binary to control Ghostscript use on all platforms #7392
+ [radarhere]
+
+- Read bounding box information from the trailer of EPS files if specified #7382
+ [nopperl, radarhere]
+
+- Added reading 8-bit color DDS images #7426
+ [radarhere]
+
+- Added has_transparency_data #7420
+ [radarhere, hugovk]
+
- Fixed bug when reading BC5S DDS images #7401
[radarhere]
@@ -29,9 +53,6 @@ Changelog (Pillow)
- Added session type check for Linux in ImageGrab.grabclipboard() #7332
[TheNooB2706, radarhere, hugovk]
-- Read WebP duration after opening #7311
- [k128, radarhere]
-
- Allow "loop=None" when saving GIF images #7329
[radarhere]
diff --git a/MANIFEST.in b/MANIFEST.in
index 606e7e074..2bbddefa3 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -29,3 +29,4 @@ global-exclude .git*
global-exclude *.pyc
global-exclude *.so
prune .ci
+prune wheels
diff --git a/README.md b/README.md
index af1ca57c2..994146cd5 100644
--- a/README.md
+++ b/README.md
@@ -45,12 +45,12 @@ As of 2019, Pillow development is
-
- ![]()
+
+ src="https://img.shields.io/travis/com/python-pillow/Pillow/main.svg?label=aarch64%20wheels">
diff --git a/RELEASING.md b/RELEASING.md
index 604bb1b8c..0229dbbc1 100644
--- a/RELEASING.md
+++ b/RELEASING.md
@@ -10,7 +10,7 @@ Released quarterly on January 2nd, April 1st, July 1st and October 15th.
* [ ] Open a release ticket e.g. https://github.com/python-pillow/Pillow/issues/3154
* [ ] Develop and prepare release in `main` branch.
* [ ] Check [GitHub Actions](https://github.com/python-pillow/Pillow/actions) and [AppVeyor](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm passing tests in `main` branch.
-* [ ] Check that all of the wheel builds [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels) pass the tests in Travis CI and GitHub Actions.
+* [ ] Check that all of the wheel builds pass the tests in the [GitHub Actions "Wheels" workflow](https://github.com/python-pillow/Pillow/actions/workflows/wheels.yml) and [Travis CI](https://app.travis-ci.com/github/python-pillow/pillow) jobs by manually triggering them.
* [ ] In compliance with [PEP 440](https://peps.python.org/pep-0440/), update version identifier in `src/PIL/_version.py`
* [ ] Update `CHANGES.rst`.
* [ ] Run pre-release check via `make release-test` in a freshly cloned repo.
@@ -99,17 +99,14 @@ Released as needed privately to individual vendors for critical security-related
## Binary Distributions
### macOS and Linux
-* [ ] Use the [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels):
+* [ ] Download wheels from the [GitHub Actions "Wheels" workflow](https://github.com/python-pillow/Pillow/actions/workflows/wheels.yml)
+ and copy into `dist/`. For example using [GitHub CLI](https://github.com/cli/cli):
```bash
- git clone https://github.com/python-pillow/pillow-wheels
- cd pillow-wheels
- ./update-pillow-tag.sh [[release tag]]
- ```
-* [ ] Download wheels from the [Pillow Wheel Builder release](https://github.com/python-pillow/pillow-wheels/releases)
- and copy into `dist/`. For example using [GitHub CLI](https://github.com/cli/cli) from the main repo:
- ```bash
- gh release download --dir dist --pattern "*.whl" --repo python-pillow/pillow-wheels
+ gh run download --dir dist
+ # select dist-x.y.z
```
+* [ ] Download the Linux aarch64 wheels created by Travis CI from [GitHub releases](https://github.com/python-pillow/Pillow/releases)
+ and copy into `dist`.
### Windows
* [ ] Download the artifacts from the [GitHub Actions "Test Windows" workflow](https://github.com/python-pillow/Pillow/actions/workflows/test-windows.yml)
diff --git a/Tests/check_j2k_leaks.py b/Tests/check_j2k_leaks.py
old mode 100755
new mode 100644
diff --git a/Tests/fonts/DejaVuSans/LICENSE.txt b/Tests/fonts/DejaVuSans/LICENSE.txt
index 30516578f..be6a4d84c 100644
--- a/Tests/fonts/DejaVuSans/LICENSE.txt
+++ b/Tests/fonts/DejaVuSans/LICENSE.txt
@@ -37,4 +37,4 @@ The Font Software may be sold as part of a larger software package but no copy o
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
-Except as contained in this notice, the name of Tavmjong Bah shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written authorization from Tavmjong Bah. For further information, contact: tavmjong @ free . fr.
\ No newline at end of file
+Except as contained in this notice, the name of Tavmjong Bah shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Font Software without prior written authorization from Tavmjong Bah. For further information, contact: tavmjong @ free . fr.
diff --git a/Tests/helper.py b/Tests/helper.py
index 69246bfcf..de5468d84 100644
--- a/Tests/helper.py
+++ b/Tests/helper.py
@@ -91,7 +91,7 @@ def assert_image_equal(a, b, msg=None):
if HAS_UPLOADER:
try:
url = test_image_results.upload(a, b)
- logger.error(f"Url for test images: {url}")
+ logger.error("URL for test images: %s", url)
except Exception:
pass
@@ -126,7 +126,7 @@ def assert_image_similar(a, b, epsilon, msg=None):
if HAS_UPLOADER:
try:
url = test_image_results.upload(a, b)
- logger.error(f"Url for test images: {url}")
+ logger.exception("URL for test images: %s", url)
except Exception:
pass
raise e
diff --git a/Tests/icc/LICENSE.txt b/Tests/icc/LICENSE.txt
index 7d289c331..7119461ed 100644
--- a/Tests/icc/LICENSE.txt
+++ b/Tests/icc/LICENSE.txt
@@ -22,4 +22,3 @@ and that the name of ICC shall not be used in advertising or publicity
pertaining to distribution of the software without specific, written
prior permission. ICC makes no representations about the suitability
of this software for any purpose.
-
diff --git a/Tests/images/bc5s.png b/Tests/images/bc5s.png
index 657d72305..5e7a1b95e 100644
Binary files a/Tests/images/bc5s.png and b/Tests/images/bc5s.png differ
diff --git a/Tests/images/imagedraw_rectangle_I.png b/Tests/images/imagedraw_rectangle_I.png
index 4e94f6943..a75f12c2e 100644
Binary files a/Tests/images/imagedraw_rectangle_I.png and b/Tests/images/imagedraw_rectangle_I.png differ
diff --git a/Tests/images/negative_size.ppm b/Tests/images/negative_size.ppm
old mode 100755
new mode 100644
diff --git a/Tests/images/palette.dds b/Tests/images/palette.dds
new file mode 100644
index 000000000..7171cb1f2
Binary files /dev/null and b/Tests/images/palette.dds differ
diff --git a/Tests/images/zero_bb_eof_before_boundingbox.eps b/Tests/images/zero_bb_eof_before_boundingbox.eps
new file mode 100644
index 000000000..c268bffd1
Binary files /dev/null and b/Tests/images/zero_bb_eof_before_boundingbox.eps differ
diff --git a/Tests/images/zero_bb_trailer.eps b/Tests/images/zero_bb_trailer.eps
new file mode 100644
index 000000000..964889965
Binary files /dev/null and b/Tests/images/zero_bb_trailer.eps differ
diff --git a/Tests/test_file_dds.py b/Tests/test_file_dds.py
index ae4831d48..bb9af7967 100644
--- a/Tests/test_file_dds.py
+++ b/Tests/test_file_dds.py
@@ -298,6 +298,11 @@ def test_dxt5_colorblock_alpha_issue_4142():
assert px[2] != 0
+def test_palette():
+ with Image.open("Tests/images/palette.dds") as im:
+ assert_image_equal_tofile(im, "Tests/images/transparent.gif")
+
+
def test_unimplemented_pixel_format():
with pytest.raises(NotImplementedError):
with Image.open("Tests/images/unimplemented_pixel_format.dds"):
diff --git a/Tests/test_file_eps.py b/Tests/test_file_eps.py
index 26adfff87..259cf75c3 100644
--- a/Tests/test_file_eps.py
+++ b/Tests/test_file_eps.py
@@ -8,6 +8,7 @@ from .helper import (
assert_image_similar,
assert_image_similar_tofile,
hopper,
+ is_win32,
mark_if_feature_version,
skip_unless_feature,
)
@@ -98,6 +99,20 @@ def test_load():
assert im.load()[0, 0] == (255, 255, 255)
+def test_binary():
+ if HAS_GHOSTSCRIPT:
+ assert EpsImagePlugin.gs_binary is not None
+ else:
+ assert EpsImagePlugin.gs_binary is False
+
+ if not is_win32():
+ assert EpsImagePlugin.gs_windows_binary is None
+ elif not HAS_GHOSTSCRIPT:
+ assert EpsImagePlugin.gs_windows_binary is False
+ else:
+ assert EpsImagePlugin.gs_windows_binary is not None
+
+
def test_invalid_file():
invalid_file = "Tests/images/flower.jpg"
with pytest.raises(SyntaxError):
@@ -404,3 +419,18 @@ def test_timeout(test_file):
with pytest.raises(Image.UnidentifiedImageError):
with Image.open(f):
pass
+
+
+def test_bounding_box_in_trailer():
+ # Check bounding boxes are parsed in the same way
+ # when specified in the header and the trailer
+ with Image.open("Tests/images/zero_bb_trailer.eps") as trailer_image, Image.open(
+ FILE1
+ ) as header_image:
+ assert trailer_image.size == header_image.size
+
+
+def test_eof_before_bounding_box():
+ with pytest.raises(OSError):
+ with Image.open("Tests/images/zero_bb_eof_before_boundingbox.eps"):
+ pass
diff --git a/Tests/test_file_gif.py b/Tests/test_file_gif.py
index d571692b1..3c2e96356 100644
--- a/Tests/test_file_gif.py
+++ b/Tests/test_file_gif.py
@@ -205,14 +205,14 @@ def test_optimize_full_l():
def test_optimize_if_palette_can_be_reduced_by_half():
- with Image.open("Tests/images/test.colors.gif") as im:
- # Reduce dimensions because original is too big for _get_optimize()
- im = im.resize((591, 443))
- im_rgb = im.convert("RGB")
+ im = Image.new("P", (8, 1))
+ im.palette = ImagePalette.raw("RGB", bytes((0, 0, 0) * 150))
+ for i in range(8):
+ im.putpixel((i, 0), (i + 1, 0, 0))
for optimize, colors in ((False, 256), (True, 8)):
out = BytesIO()
- im_rgb.save(out, "GIF", optimize=optimize)
+ im.save(out, "GIF", optimize=optimize)
with Image.open(out) as reloaded:
assert len(reloaded.palette.palette) // 3 == colors
@@ -1180,18 +1180,17 @@ def test_palette_save_L(tmp_path):
def test_palette_save_P(tmp_path):
- # Pass in a different palette, then construct what the image would look like.
- # Forcing a non-straight grayscale palette.
-
- im = hopper("P")
- palette = bytes(255 - i // 3 for i in range(768))
+ im = Image.new("P", (1, 2))
+ im.putpixel((0, 1), 1)
out = str(tmp_path / "temp.gif")
- im.save(out, palette=palette)
+ im.save(out, palette=bytes((1, 2, 3, 4, 5, 6)))
with Image.open(out) as reloaded:
- im.putpalette(palette)
- assert_image_equal(reloaded, im)
+ reloaded_rgb = reloaded.convert("RGB")
+
+ assert reloaded_rgb.getpixel((0, 0)) == (1, 2, 3)
+ assert reloaded_rgb.getpixel((0, 1)) == (4, 5, 6)
def test_palette_save_duplicate_entries(tmp_path):
diff --git a/Tests/test_file_iptc.py b/Tests/test_file_iptc.py
index 2d99528d3..d2edcfc27 100644
--- a/Tests/test_file_iptc.py
+++ b/Tests/test_file_iptc.py
@@ -1,5 +1,5 @@
import sys
-from io import StringIO
+from io import BytesIO, StringIO
from PIL import Image, IptcImagePlugin
@@ -30,6 +30,36 @@ def test_getiptcinfo_jpg_found():
assert iptc[(2, 101)] == b"Hungary"
+def test_getiptcinfo_fotostation():
+ # Arrange
+ with open(TEST_FILE, "rb") as fp:
+ data = bytearray(fp.read())
+ data[86] = 240
+ f = BytesIO(data)
+ with Image.open(f) as im:
+ # Act
+ iptc = IptcImagePlugin.getiptcinfo(im)
+
+ # Assert
+ for tag in iptc.keys():
+ if tag[0] == 240:
+ return
+ assert False, "FotoStation tag not found"
+
+
+def test_getiptcinfo_zero_padding():
+ # Arrange
+ with Image.open(TEST_FILE) as im:
+ im.info["photoshop"][0x0404] += b"\x00\x00\x00"
+
+ # Act
+ iptc = IptcImagePlugin.getiptcinfo(im)
+
+ # Assert
+ assert isinstance(iptc, dict)
+ assert len(iptc) == 3
+
+
def test_getiptcinfo_tiff_none():
# Arrange
with Image.open("Tests/images/hopper.tif") as im:
diff --git a/Tests/test_file_webp.py b/Tests/test_file_webp.py
index 3832441c0..30938e971 100644
--- a/Tests/test_file_webp.py
+++ b/Tests/test_file_webp.py
@@ -233,4 +233,15 @@ class TestFileWebp:
im.save(out_webp, save_all=True)
with Image.open(out_webp) as reloaded:
+ reloaded.load()
assert reloaded.info["duration"] == 1000
+
+ def test_roundtrip_rgba_palette(self, tmp_path):
+ temp_file = str(tmp_path / "temp.webp")
+ im = Image.new("RGBA", (1, 1)).convert("P")
+ assert im.mode == "P"
+ assert im.palette.mode == "RGBA"
+ im.save(temp_file)
+
+ with Image.open(temp_file) as im:
+ assert im.getpixel((0, 0)) == (0, 0, 0, 0)
diff --git a/Tests/test_image.py b/Tests/test_image.py
index 7df1916ef..83dac7080 100644
--- a/Tests/test_image.py
+++ b/Tests/test_image.py
@@ -638,8 +638,8 @@ class TestImage:
im.remap_palette(None)
def test_remap_palette_transparency(self):
- im = Image.new("P", (1, 2))
- im.putpixel((0, 1), 1)
+ im = Image.new("P", (1, 2), (0, 0, 0))
+ im.putpixel((0, 1), (255, 0, 0))
im.info["transparency"] = 0
im_remapped = im.remap_palette([1, 0])
@@ -906,6 +906,31 @@ class TestImage:
im = Image.new("RGB", size)
assert im.tobytes() == b""
+ def test_has_transparency_data(self):
+ for mode in ("1", "L", "P", "RGB"):
+ im = Image.new(mode, (1, 1))
+ assert not im.has_transparency_data
+
+ for mode in ("LA", "La", "PA", "RGBA", "RGBa"):
+ im = Image.new(mode, (1, 1))
+ assert im.has_transparency_data
+
+ # P mode with "transparency" info
+ with Image.open("Tests/images/first_frame_transparency.gif") as im:
+ assert "transparency" in im.info
+ assert im.has_transparency_data
+
+ # RGB mode with "transparency" info
+ with Image.open("Tests/images/rgb_trns.png") as im:
+ assert "transparency" in im.info
+ assert im.has_transparency_data
+
+ # P mode with RGBA palette
+ im = Image.new("RGBA", (1, 1)).convert("P")
+ assert im.mode == "P"
+ assert im.palette.mode == "RGBA"
+ assert im.has_transparency_data
+
def test_apply_transparency(self):
im = Image.new("P", (1, 1))
im.putpalette((0, 0, 0, 1, 1, 1))
diff --git a/Tests/test_image_convert.py b/Tests/test_image_convert.py
index 01a182cf1..f5775f09c 100644
--- a/Tests/test_image_convert.py
+++ b/Tests/test_image_convert.py
@@ -117,11 +117,11 @@ def test_trns_p(tmp_path):
f = str(tmp_path / "temp.png")
im_l = im.convert("L")
- assert im_l.info["transparency"] == 1 # undone
+ assert im_l.info["transparency"] == 0
im_l.save(f)
im_rgb = im.convert("RGB")
- assert im_rgb.info["transparency"] == (0, 1, 2) # undone
+ assert im_rgb.info["transparency"] == (0, 0, 0)
im_rgb.save(f)
diff --git a/Tests/test_image_putpalette.py b/Tests/test_image_putpalette.py
index 665e08a7e..376553344 100644
--- a/Tests/test_image_putpalette.py
+++ b/Tests/test_image_putpalette.py
@@ -84,3 +84,14 @@ def test_rgba_palette(mode, palette):
im.putpalette(palette, mode)
assert im.getpalette() == [1, 2, 3]
assert im.palette.colors == {(1, 2, 3, 4): 0}
+
+
+def test_empty_palette():
+ im = Image.new("P", (1, 1))
+ assert im.getpalette() == []
+
+
+def test_undefined_palette_index():
+ im = Image.new("P", (1, 1), 3)
+ im.putpalette((1, 2, 3))
+ assert im.convert("RGB").getpixel((0, 0)) == (0, 0, 0)
diff --git a/Tests/test_imagedraw.py b/Tests/test_imagedraw.py
index ca6235447..1650cfa44 100644
--- a/Tests/test_imagedraw.py
+++ b/Tests/test_imagedraw.py
@@ -586,6 +586,18 @@ def test_point(points):
assert_image_equal_tofile(im, "Tests/images/imagedraw_point.png")
+def test_point_I16():
+ # Arrange
+ im = Image.new("I;16", (1, 1))
+ draw = ImageDraw.Draw(im)
+
+ # Act
+ draw.point((0, 0), fill=0x1234)
+
+ # Assert
+ assert im.getpixel((0, 0)) == 0x1234
+
+
@pytest.mark.parametrize("points", POINTS)
def test_polygon(points):
# Arrange
@@ -732,7 +744,7 @@ def test_rectangle_I16(bbox):
draw = ImageDraw.Draw(im)
# Act
- draw.rectangle(bbox, fill="black", outline="green")
+ draw.rectangle(bbox, outline=0xFFFF)
# Assert
assert_image_equal_tofile(im.convert("I"), "Tests/images/imagedraw_rectangle_I.png")
diff --git a/Tests/test_imagefont.py b/Tests/test_imagefont.py
index 02622e721..343ecda82 100644
--- a/Tests/test_imagefont.py
+++ b/Tests/test_imagefont.py
@@ -141,7 +141,9 @@ def test_I16(font):
draw = ImageDraw.Draw(im)
txt = "Hello World!"
- draw.text((10, 10), txt, font=font)
+ draw.text((10, 10), txt, fill=0xFFFE, font=font)
+
+ assert im.getpixel((12, 14)) == 0xFFFE
target = "Tests/images/transparent_background_text_L.png"
assert_image_similar_tofile(im.convert("L"), target, 0.01)
diff --git a/_custom_build/backend.py b/_custom_build/backend.py
old mode 100755
new mode 100644
diff --git a/depends/install_raqm.sh b/depends/install_raqm.sh
index 24c1f9c30..070ba23a1 100755
--- a/depends/install_raqm.sh
+++ b/depends/install_raqm.sh
@@ -11,4 +11,3 @@ pushd $archive
meson build --prefix=/usr && sudo ninja -C build install
popd
-
diff --git a/depends/install_raqm_cmake.sh b/depends/install_raqm_cmake.sh
index 7d2c399df..37d9d1160 100755
--- a/depends/install_raqm_cmake.sh
+++ b/depends/install_raqm_cmake.sh
@@ -15,4 +15,3 @@ make && sudo make install
cd ..
popd
-
diff --git a/depends/termux.sh b/depends/termux.sh
index 1acc09c44..d437029fd 100755
--- a/depends/termux.sh
+++ b/depends/termux.sh
@@ -2,4 +2,3 @@
pkg install -y python ndk-sysroot clang make \
libjpeg-turbo
-
diff --git a/docs/about.rst b/docs/about.rst
index 03829c133..872ac0ea6 100644
--- a/docs/about.rst
+++ b/docs/about.rst
@@ -12,7 +12,7 @@ The fork author's goal is to foster and support active development of PIL throug
.. _GitHub Actions: https://github.com/python-pillow/Pillow/actions
.. _AppVeyor: https://ci.appveyor.com/project/Python-pillow/pillow
-.. _Travis CI: https://app.travis-ci.com/github/python-pillow/pillow-wheels
+.. _Travis CI: https://app.travis-ci.com/github/python-pillow/Pillow
.. _GitHub: https://github.com/python-pillow/Pillow
.. _Python Package Index: https://pypi.org/project/Pillow/
diff --git a/docs/handbook/image-file-formats.rst b/docs/handbook/image-file-formats.rst
index 2a42bdacb..d5d95d3ce 100644
--- a/docs/handbook/image-file-formats.rst
+++ b/docs/handbook/image-file-formats.rst
@@ -63,8 +63,35 @@ DDS
^^^
DDS is a popular container texture format used in video games and natively supported
-by DirectX. Uncompressed RGB and RGBA can be read, and (since 8.3.0) written. DXT1,
-DXT3 (since 3.4.0) and DXT5 pixel formats can be read, only in ``RGBA`` mode.
+by DirectX.
+
+DXT1 and DXT5 pixel formats can be read, only in ``RGBA`` mode.
+
+.. versionadded:: 3.4.0
+ DXT3 images can be read in ``RGB`` mode and DX10 images can be read in
+ ``RGB`` and ``RGBA`` mode.
+
+.. versionadded:: 6.0.0
+ Uncompressed ``RGBA`` images can be read.
+
+
+.. versionadded:: 8.3.0
+ BC5S images can be opened in ``RGB`` mode, and uncompressed ``RGB`` images
+ can be read. Uncompressed data can also be saved to image files.
+
+
+.. versionadded:: 9.3.0
+ ATI1 images can be opened in ``L`` mode and ATI2 images can be opened in
+ ``RGB`` mode.
+
+.. versionadded:: 9.4.0
+ Uncompressed ``L`` ("luminance") and ``LA`` images can be opened and saved.
+
+
+.. versionadded:: 10.1.0
+ BC5U can be read in ``RGB`` mode, and 8-bit color indexed images can be read
+ in ``P`` mode.
+
DIB
^^^
@@ -88,8 +115,13 @@ in ``L``, ``RGB`` and ``CMYK`` modes.
Loading
~~~~~~~
+To use Ghostscript, Pillow searches for the "gs" executable. On Windows, it
+also searches for "gswin32c" and "gswin64c". To customise this behaviour,
+``EpsImagePlugin.gs_binary = "gswin64"`` will set the name of the executable to
+use. ``EpsImagePlugin.gs_binary = False`` will prevent Ghostscript use.
+
If Ghostscript is available, you can call the :py:meth:`~PIL.Image.Image.load`
-method with the following parameters to affect how Ghostscript renders the EPS
+method with the following parameters to affect how Ghostscript renders the EPS.
**scale**
Affects the scale of the resultant rasterized image. If the EPS suggests
diff --git a/docs/index.rst b/docs/index.rst
index 418844ba7..99da614a4 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -37,12 +37,12 @@ Pillow for enterprise is available via the Tidelift Subscription. `Learn more bool:
+ """
+ Determine if an image has transparency data, whether in the form of an
+ alpha channel, a palette with an alpha channel, or a "transparency" key
+ in the info dictionary.
+
+ Note the image might still appear solid, if all of the values shown
+ within are opaque.
+
+ :returns: A boolean.
+ """
+ return (
+ self.mode in ("LA", "La", "PA", "RGBA", "RGBa")
+ or (self.mode == "P" and self.palette.mode.endswith("A"))
+ or "transparency" in self.info
+ )
+
def apply_transparency(self):
"""
If a P mode image has a "transparency" key in the info dictionary,
diff --git a/src/PIL/ImageFont.py b/src/PIL/ImageFont.py
index b77dc6ab1..5d361db52 100644
--- a/src/PIL/ImageFont.py
+++ b/src/PIL/ImageFont.py
@@ -563,14 +563,21 @@ class FreeTypeFont:
if start is None:
start = (0, 0)
im = None
+ size = None
- def fill(mode, size):
- nonlocal im
+ def fill(mode, im_size):
+ nonlocal im, size
+
+ size = im_size
+ if Image.MAX_IMAGE_PIXELS is not None:
+ pixels = max(1, size[0]) * max(1, size[1])
+ if pixels > 2 * Image.MAX_IMAGE_PIXELS:
+ return
im = Image.core.fill(mode, size)
return im
- size, offset = self.font.render(
+ offset = self.font.render(
text,
fill,
mode,
@@ -582,7 +589,6 @@ class FreeTypeFont:
ink,
start[0],
start[1],
- Image.MAX_IMAGE_PIXELS,
)
Image._decompression_bomb_check(size)
return im, offset
diff --git a/src/PIL/ImageGrab.py b/src/PIL/ImageGrab.py
index 43019f74a..bcfffc3dc 100644
--- a/src/PIL/ImageGrab.py
+++ b/src/PIL/ImageGrab.py
@@ -166,7 +166,7 @@ def grabclipboard():
msg = "wl-paste or xclip is required for ImageGrab.grabclipboard() on Linux"
raise NotImplementedError(msg)
- p = subprocess.run(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ p = subprocess.run(args, capture_output=True)
err = p.stderr
if err:
msg = f"{args[0]} error: {err.strip().decode()}"
diff --git a/src/PIL/IptcImagePlugin.py b/src/PIL/IptcImagePlugin.py
index 6ce4975c0..316cd17c7 100644
--- a/src/PIL/IptcImagePlugin.py
+++ b/src/PIL/IptcImagePlugin.py
@@ -58,13 +58,13 @@ class IptcImageFile(ImageFile.ImageFile):
#
# get a IPTC field header
s = self.fp.read(5)
- if not len(s):
+ if not s.strip(b"\x00"):
return None, 0
tag = s[1], s[2]
# syntax
- if s[0] != 0x1C or tag[0] < 1 or tag[0] > 9:
+ if s[0] != 0x1C or tag[0] not in [1, 2, 3, 4, 5, 6, 7, 8, 9, 240]:
msg = "invalid IPTC/NAA file"
raise SyntaxError(msg)
diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py
index 996dac4af..dabf8dbfb 100644
--- a/src/PIL/TiffImagePlugin.py
+++ b/src/PIL/TiffImagePlugin.py
@@ -825,7 +825,7 @@ class ImageFileDirectory_v2(MutableMapping):
try:
unit_size, handler = self._load_dispatch[typ]
except KeyError:
- logger.debug(msg + f" - unsupported type {typ}")
+ logger.debug("%s - unsupported type %s", msg, typ)
continue # ignore unsupported type
size = count * unit_size
if size > (8 if self._bigtiff else 4):
@@ -882,7 +882,7 @@ class ImageFileDirectory_v2(MutableMapping):
if tag == STRIPOFFSETS:
stripoffsets = len(entries)
typ = self.tagtype.get(tag)
- logger.debug(f"Tag {tag}, Type: {typ}, Value: {repr(value)}")
+ logger.debug("Tag %s, Type: %s, Value: %s", tag, typ, repr(value))
is_ifd = typ == TiffTags.LONG and isinstance(value, dict)
if is_ifd:
if self._endian == "<":
@@ -931,7 +931,7 @@ class ImageFileDirectory_v2(MutableMapping):
# pass 2: write entries to file
for tag, typ, count, value, data in entries:
- logger.debug(f"{tag} {typ} {count} {repr(value)} {repr(data)}")
+ logger.debug("%s %s %s %s %s", tag, typ, count, repr(value), repr(data))
result += self._pack("HHL4s", tag, typ, count, value)
# -- overwrite here for multi-page --
@@ -1100,8 +1100,8 @@ class TiffImageFile(ImageFile.ImageFile):
self._n_frames = None
logger.debug("*** TiffImageFile._open ***")
- logger.debug(f"- __first: {self.__first}")
- logger.debug(f"- ifh: {repr(ifh)}") # Use repr to avoid str(bytes)
+ logger.debug("- __first: %s", self.__first)
+ logger.debug("- ifh: %s", repr(ifh)) # Use repr to avoid str(bytes)
# and load the first frame
self._seek(0)
@@ -1139,12 +1139,15 @@ class TiffImageFile(ImageFile.ImageFile):
msg = "no more images in TIFF file"
raise EOFError(msg)
logger.debug(
- f"Seeking to frame {frame}, on frame {self.__frame}, "
- f"__next {self.__next}, location: {self.fp.tell()}"
+ "Seeking to frame %s, on frame %s, __next %s, location: %s",
+ frame,
+ self.__frame,
+ self.__next,
+ self.fp.tell(),
)
self.fp.seek(self.__next)
self._frame_pos.append(self.__next)
- logger.debug("Loading tags, location: %s" % self.fp.tell())
+ logger.debug("Loading tags, location: %s", self.fp.tell())
self.tag_v2.load(self.fp)
if self.tag_v2.next in self._frame_pos:
# This IFD has already been processed
@@ -1332,18 +1335,18 @@ class TiffImageFile(ImageFile.ImageFile):
fillorder = self.tag_v2.get(FILLORDER, 1)
logger.debug("*** Summary ***")
- logger.debug(f"- compression: {self._compression}")
- logger.debug(f"- photometric_interpretation: {photo}")
- logger.debug(f"- planar_configuration: {self._planar_configuration}")
- logger.debug(f"- fill_order: {fillorder}")
- logger.debug(f"- YCbCr subsampling: {self.tag.get(YCBCRSUBSAMPLING)}")
+ logger.debug("- compression: %s", self._compression)
+ logger.debug("- photometric_interpretation: %s", photo)
+ logger.debug("- planar_configuration: %s", self._planar_configuration)
+ logger.debug("- fill_order: %s", fillorder)
+ logger.debug("- YCbCr subsampling: %s", self.tag.get(YCBCRSUBSAMPLING))
# size
xsize = int(self.tag_v2.get(IMAGEWIDTH))
ysize = int(self.tag_v2.get(IMAGELENGTH))
self._size = xsize, ysize
- logger.debug(f"- size: {self.size}")
+ logger.debug("- size: %s", self.size)
sample_format = self.tag_v2.get(SAMPLEFORMAT, (1,))
if len(sample_format) > 1 and max(sample_format) == min(sample_format) == 1:
@@ -1399,7 +1402,7 @@ class TiffImageFile(ImageFile.ImageFile):
bps_tuple,
extra_tuple,
)
- logger.debug(f"format key: {key}")
+ logger.debug("format key: %s", key)
try:
self._mode, rawmode = OPEN_INFO[key]
except KeyError as e:
@@ -1407,8 +1410,8 @@ class TiffImageFile(ImageFile.ImageFile):
msg = "unknown pixel mode"
raise SyntaxError(msg) from e
- logger.debug(f"- raw mode: {rawmode}")
- logger.debug(f"- pil mode: {self.mode}")
+ logger.debug("- raw mode: %s", rawmode)
+ logger.debug("- pil mode: %s", self.mode)
self.info["compression"] = self._compression
@@ -1449,7 +1452,7 @@ class TiffImageFile(ImageFile.ImageFile):
if fillorder == 2:
# Replace fillorder with fillorder=1
key = key[:3] + (1,) + key[4:]
- logger.debug(f"format key: {key}")
+ logger.debug("format key: %s", key)
# this should always work, since all the
# fillorder==2 modes have a corresponding
# fillorder=1 mode
@@ -1612,7 +1615,7 @@ def _save(im, fp, filename):
info = exif
else:
info = {}
- logger.debug("Tiffinfo Keys: %s" % list(info))
+ logger.debug("Tiffinfo Keys: %s", list(info))
if isinstance(info, ImageFileDirectory_v1):
info = info.to_v2()
for key in info:
@@ -1745,7 +1748,7 @@ def _save(im, fp, filename):
ifd[JPEGQUALITY] = quality
logger.debug("Saving using libtiff encoder")
- logger.debug("Items: %s" % sorted(ifd.items()))
+ logger.debug("Items: %s", sorted(ifd.items()))
_fp = 0
if hasattr(fp, "fileno"):
try:
@@ -1813,7 +1816,7 @@ def _save(im, fp, filename):
if SAMPLEFORMAT in atts and len(atts[SAMPLEFORMAT]) == 1:
atts[SAMPLEFORMAT] = atts[SAMPLEFORMAT][0]
- logger.debug("Converted items: %s" % sorted(atts.items()))
+ logger.debug("Converted items: %s", sorted(atts.items()))
# libtiff always expects the bytes in native order.
# we're storing image byte order. So, if the rawmode
diff --git a/src/PIL/WebPImagePlugin.py b/src/PIL/WebPImagePlugin.py
index a6e1a2a00..612fc0946 100644
--- a/src/PIL/WebPImagePlugin.py
+++ b/src/PIL/WebPImagePlugin.py
@@ -74,9 +74,6 @@ class WebPImageFile(ImageFile.ImageFile):
self.info["background"] = (bg_r, bg_g, bg_b, bg_a)
self.n_frames = frame_count
self.is_animated = self.n_frames > 1
- ret = self._decoder.get_next()
- if ret is not None:
- self.info["duration"] = ret[1]
self._mode = "RGB" if mode == "RGBX" else mode
self.rawmode = mode
self.tile = []
@@ -93,7 +90,7 @@ class WebPImageFile(ImageFile.ImageFile):
self.info["xmp"] = xmp
# Initialize seek state
- self._reset()
+ self._reset(reset=False)
def _getexif(self):
if "exif" not in self.info:
@@ -116,8 +113,9 @@ class WebPImageFile(ImageFile.ImageFile):
# Set logical frame to requested position
self.__logical_frame = frame
- def _reset(self):
- self._decoder.reset()
+ def _reset(self, reset=True):
+ if reset:
+ self._decoder.reset()
self.__physical_frame = 0
self.__loaded = -1
self.__timestamp = 0
@@ -332,12 +330,7 @@ def _save(im, fp, filename):
exact = 1 if im.encoderinfo.get("exact") else 0
if im.mode not in _VALID_WEBP_LEGACY_MODES:
- alpha = (
- "A" in im.mode
- or "a" in im.mode
- or (im.mode == "P" and "transparency" in im.info)
- )
- im = im.convert("RGBA" if alpha else "RGB")
+ im = im.convert("RGBA" if im.has_transparency_data else "RGB")
data = _webp.WebPEncode(
im.tobytes(),
diff --git a/src/_imagingft.c b/src/_imagingft.c
index 2165fbc7a..64175de8b 100644
--- a/src/_imagingft.c
+++ b/src/_imagingft.c
@@ -815,7 +815,6 @@ font_render(FontObject *self, PyObject *args) {
float y_start = 0;
int width, height, x_offset, y_offset;
int horizontal_dir; /* is primary axis horizontal? */
- PyObject *max_image_pixels = Py_None;
/* render string into given buffer (the buffer *must* have
the right size, or this will crash) */
@@ -833,8 +832,7 @@ font_render(FontObject *self, PyObject *args) {
&anchor,
&foreground_ink_long,
&x_start,
- &y_start,
- &max_image_pixels)) {
+ &y_start)) {
return NULL;
}
@@ -879,15 +877,11 @@ font_render(FontObject *self, PyObject *args) {
width += stroke_width * 2 + ceil(x_start);
height += stroke_width * 2 + ceil(y_start);
- if (max_image_pixels != Py_None) {
- if ((long long)(width > 1 ? width : 1) * (height > 1 ? height : 1) > PyLong_AsLongLong(max_image_pixels) * 2) {
- PyMem_Del(glyph_info);
- return Py_BuildValue("(ii)(ii)", width, height, 0, 0);
- }
- }
-
image = PyObject_CallFunction(fill, "s(ii)", strcmp(mode, "RGBA") == 0 ? "RGBA" : "L", width, height);
- if (image == NULL) {
+ if (image == Py_None) {
+ PyMem_Del(glyph_info);
+ return Py_BuildValue("ii", 0, 0);
+ } else if (image == NULL) {
PyMem_Del(glyph_info);
return NULL;
}
@@ -898,7 +892,7 @@ font_render(FontObject *self, PyObject *args) {
y_offset -= stroke_width;
if (count == 0 || width == 0 || height == 0) {
PyMem_Del(glyph_info);
- return Py_BuildValue("(ii)(ii)", width, height, x_offset, y_offset);
+ return Py_BuildValue("ii", x_offset, y_offset);
}
if (stroke_width) {
@@ -1116,7 +1110,7 @@ font_render(FontObject *self, PyObject *args) {
Py_DECREF(image);
FT_Stroker_Done(stroker);
PyMem_Del(glyph_info);
- return Py_BuildValue("(ii)(ii)", width, height, x_offset, y_offset);
+ return Py_BuildValue("ii", x_offset, y_offset);
glyph_error:
if (im->destroy) {
diff --git a/src/libImaging/BcnDecode.c b/src/libImaging/BcnDecode.c
index dfd4b3e07..5e4296eeb 100644
--- a/src/libImaging/BcnDecode.c
+++ b/src/libImaging/BcnDecode.c
@@ -850,10 +850,12 @@ decode_bcn(
DECODE_LOOP(3, 16, rgba);
DECODE_LOOP(4, 8, lum);
case 5:
+ {
+ int sign = strcmp(pixel_format, "BC5S") == 0 ? 1 : 0;
while (bytes >= 16) {
rgba col[16];
- memset(col, 0, 16 * sizeof(col[0]));
- decode_bc5_block(col, ptr, strcmp(pixel_format, "BC5S") == 0 ? 1 : 0);
+ memset(col, sign ? 128 : 0, 16 * sizeof(col[0]));
+ decode_bc5_block(col, ptr, sign);
put_block(im, state, (const char *)col, sizeof(col[0]), C);
ptr += 16;
bytes -= 16;
@@ -862,10 +864,13 @@ decode_bcn(
}
}
break;
+ }
case 6:
+ {
+ int sign = strcmp(pixel_format, "BC6HS") == 0 ? 1 : 0;
while (bytes >= 16) {
rgba col[16];
- decode_bc6_block(col, ptr, strcmp(pixel_format, "BC6HS") == 0 ? 1 : 0);
+ decode_bc6_block(col, ptr, sign);
put_block(im, state, (const char *)col, sizeof(col[0]), C);
ptr += 16;
bytes -= 16;
@@ -874,6 +879,7 @@ decode_bcn(
}
}
break;
+ }
DECODE_LOOP(7, 16, rgba);
#undef DECODE_LOOP
}
diff --git a/src/libImaging/Convert.c b/src/libImaging/Convert.c
index 7fe24a639..7677a81f7 100644
--- a/src/libImaging/Convert.c
+++ b/src/libImaging/Convert.c
@@ -1295,7 +1295,6 @@ topalette(
int alpha;
int x, y;
ImagingPalette palette = inpalette;
- ;
/* Map L or RGB/RGBX/RGBA to palette image */
if (strcmp(imIn->mode, "L") != 0 && strncmp(imIn->mode, "RGB", 3) != 0) {
@@ -1307,7 +1306,14 @@ topalette(
if (palette == NULL) {
/* FIXME: make user configurable */
if (imIn->bands == 1) {
- palette = ImagingPaletteNew("RGB"); /* Initialised to grey ramp */
+ palette = ImagingPaletteNew("RGB");
+
+ palette->size = 256;
+ int i;
+ for (i = 0; i < 256; i++) {
+ palette->palette[i * 4] = palette->palette[i * 4 + 1] =
+ palette->palette[i * 4 + 2] = (UINT8)i;
+ }
} else {
palette = ImagingPaletteNewBrowser(); /* Standard colour cube */
}
diff --git a/src/libImaging/Draw.c b/src/libImaging/Draw.c
index 82f290bd0..0ccf22d58 100644
--- a/src/libImaging/Draw.c
+++ b/src/libImaging/Draw.c
@@ -41,6 +41,7 @@
#define FLOOR(v) ((v) >= 0.0 ? (int)(v) : (int)floor(v))
#define INK8(ink) (*(UINT8 *)ink)
+#define INK16(ink) (*(UINT16 *)ink)
/*
* Rounds around zero (up=away from zero, down=towards zero)
@@ -68,8 +69,13 @@ static inline void
point8(Imaging im, int x, int y, int ink) {
if (x >= 0 && x < im->xsize && y >= 0 && y < im->ysize) {
if (strncmp(im->mode, "I;16", 4) == 0) {
- im->image8[y][x * 2] = (UINT8)ink;
+#ifdef WORDS_BIGENDIAN
+ im->image8[y][x * 2] = (UINT8)(ink >> 8);
im->image8[y][x * 2 + 1] = (UINT8)ink;
+#else
+ im->image8[y][x * 2] = (UINT8)ink;
+ im->image8[y][x * 2 + 1] = (UINT8)(ink >> 8);
+#endif
} else {
im->image8[y][x] = (UINT8)ink;
}
@@ -631,13 +637,17 @@ DRAW draw32rgba = {point32rgba, hline32rgba, line32rgba, polygon32rgba};
/* Interface */
/* -------------------------------------------------------------------- */
-#define DRAWINIT() \
- if (im->image8) { \
- draw = &draw8; \
- ink = INK8(ink_); \
- } else { \
- draw = (op) ? &draw32rgba : &draw32; \
- memcpy(&ink, ink_, sizeof(ink)); \
+#define DRAWINIT() \
+ if (im->image8) { \
+ draw = &draw8; \
+ if (strncmp(im->mode, "I;16", 4) == 0) { \
+ ink = INK16(ink_); \
+ } else { \
+ ink = INK8(ink_); \
+ } \
+ } else { \
+ draw = (op) ? &draw32rgba : &draw32; \
+ memcpy(&ink, ink_, sizeof(ink)); \
}
int
diff --git a/src/libImaging/Palette.c b/src/libImaging/Palette.c
index 71a095c2c..059d7b72a 100644
--- a/src/libImaging/Palette.c
+++ b/src/libImaging/Palette.c
@@ -39,11 +39,8 @@ ImagingPaletteNew(const char *mode) {
strncpy(palette->mode, mode, IMAGING_MODE_LENGTH - 1);
palette->mode[IMAGING_MODE_LENGTH - 1] = 0;
- /* Initialize to ramp */
- palette->size = 256;
+ palette->size = 0;
for (i = 0; i < 256; i++) {
- palette->palette[i * 4 + 0] = palette->palette[i * 4 + 1] =
- palette->palette[i * 4 + 2] = (UINT8)i;
palette->palette[i * 4 + 3] = 255; /* opaque */
}
@@ -62,16 +59,10 @@ ImagingPaletteNewBrowser(void) {
return NULL;
}
- /* Blank out unused entries */
/* FIXME: Add 10-level windows palette here? */
- for (i = 0; i < 10; i++) {
- palette->palette[i * 4 + 0] = palette->palette[i * 4 + 1] =
- palette->palette[i * 4 + 2] = 0;
- }
-
/* Simple 6x6x6 colour cube */
-
+ i = 10;
for (b = 0; b < 256; b += 51) {
for (g = 0; g < 256; g += 51) {
for (r = 0; r < 256; r += 51) {
@@ -82,15 +73,10 @@ ImagingPaletteNewBrowser(void) {
}
}
}
+ palette->size = i;
- /* Blank out unused entries */
/* FIXME: add 30-level greyscale wedge here? */
- for (; i < 256; i++) {
- palette->palette[i * 4 + 0] = palette->palette[i * 4 + 1] =
- palette->palette[i * 4 + 2] = 0;
- }
-
return palette;
}
diff --git a/src/libImaging/Paste.c b/src/libImaging/Paste.c
index acf5202e5..6684b11ef 100644
--- a/src/libImaging/Paste.c
+++ b/src/libImaging/Paste.c
@@ -425,7 +425,7 @@ fill_mask_L(
*out = BLEND(*mask, *out, ink[0], tmp1);
if (strncmp(imOut->mode, "I;16", 4) == 0) {
out++;
- *out = BLEND(*mask, *out, ink[0], tmp1);
+ *out = BLEND(*mask, *out, ink[1], tmp1);
}
out++, mask++;
}
diff --git a/src/libImaging/Quant.c b/src/libImaging/Quant.c
index 02a4a5c76..c84acb998 100644
--- a/src/libImaging/Quant.c
+++ b/src/libImaging/Quant.c
@@ -1825,6 +1825,7 @@ ImagingQuantize(Imaging im, int colors, int mode, int kmeans) {
free(newData);
+ imOut->palette->size = (int)paletteLength;
pp = imOut->palette->palette;
for (i = j = 0; i < (int)paletteLength; i++) {
@@ -1832,16 +1833,9 @@ ImagingQuantize(Imaging im, int colors, int mode, int kmeans) {
*pp++ = palette[i].c.g;
*pp++ = palette[i].c.b;
if (withAlpha) {
- *pp++ = palette[i].c.a;
- } else {
- *pp++ = 255;
+ *pp = palette[i].c.a;
}
- }
- for (; i < 256; i++) {
- *pp++ = 0;
- *pp++ = 0;
- *pp++ = 0;
- *pp++ = 255;
+ pp++;
}
if (withAlpha) {
diff --git a/src/libImaging/Sgi.h b/src/libImaging/Sgi.h
index 39dd68825..797e5cbf9 100644
--- a/src/libImaging/Sgi.h
+++ b/src/libImaging/Sgi.h
@@ -36,4 +36,4 @@ typedef struct {
/* image data size from file descriptor */
long bufsize;
-} SGISTATE;
\ No newline at end of file
+} SGISTATE;
diff --git a/wheels/README.md b/wheels/README.md
new file mode 100644
index 000000000..c15c034b6
--- /dev/null
+++ b/wheels/README.md
@@ -0,0 +1,31 @@
+README
+------
+
+This directory creates wheels for tagged versions of Pillow.
+
+Archives
+--------
+
+https://github.com/python-pillow/pillow-depends contains archives for libraries
+that will be built as part of the Pillow build.
+
+In general, there is no need to put library archives there, because the
+`multibuild` scripts will download them from their respective URLs.
+
+But, the build will look in that repository before downloading from the
+URL, so if there is a library that often fails to download, or you think might
+fail to download, then download it and add it to the Git repository.
+
+See the `pre_build` in `config.sh` and the `fetch_unpack` routine in
+`multibuild/common_utils.sh` for the logic, and the build recipes in
+`multibuild/library_builders.sh` for the filename to give to the downloaded
+archive.
+
+Wheels
+------
+
+Wheels are
+[GitHub Actions artifacts created for tags, relevant changes or manual builds](https://github.com/python-pillow/Pillow/actions/workflows/wheels.yml).
+
+Windows wheels are not created here. Instead, they are
+[GitHub Actions artifacts created on each run of the Windows workflow](https://github.com/python-pillow/Pillow/actions/workflows/test-windows.yml?query=branch%3Amain).
diff --git a/wheels/config.sh b/wheels/config.sh
new file mode 100644
index 000000000..b6f89bf72
--- /dev/null
+++ b/wheels/config.sh
@@ -0,0 +1,187 @@
+# Define custom utilities
+# Test for macOS with [ -n "$IS_MACOS" ]
+
+ARCHIVE_SDIR=pillow-depends-main
+
+# Package versions for fresh source builds
+FREETYPE_VERSION=2.13.2
+HARFBUZZ_VERSION=8.2.1
+LIBPNG_VERSION=1.6.40
+JPEGTURBO_VERSION=3.0.0
+OPENJPEG_VERSION=2.5.0
+XZ_VERSION=5.4.4
+TIFF_VERSION=4.5.1
+LCMS2_VERSION=2.15
+if [[ -n "$IS_MACOS" ]]; then
+ GIFLIB_VERSION=5.1.4
+else
+ GIFLIB_VERSION=5.2.1
+fi
+if [[ -n "$IS_MACOS" ]] || [[ "$MB_ML_VER" != 2014 ]]; then
+ ZLIB_VERSION=1.3
+else
+ ZLIB_VERSION=1.2.8
+fi
+LIBWEBP_VERSION=1.3.2
+BZIP2_VERSION=1.0.8
+LIBXCB_VERSION=1.16
+BROTLI_VERSION=1.1.0
+
+if [[ -n "$IS_MACOS" ]] && [[ "$PLAT" == "x86_64" ]]; then
+ function build_openjpeg {
+ local out_dir=$(fetch_unpack https://github.com/uclouvain/openjpeg/archive/v${OPENJPEG_VERSION}.tar.gz)
+ (cd $out_dir \
+ && cmake -DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX -DCMAKE_INSTALL_NAME_DIR=$BUILD_PREFIX/lib . \
+ && make install)
+ touch openjpeg-stamp
+ }
+fi
+
+function build_brotli {
+ local cmake=$(get_modern_cmake)
+ local out_dir=$(fetch_unpack https://github.com/google/brotli/archive/v$BROTLI_VERSION.tar.gz)
+ (cd $out_dir \
+ && $cmake -DCMAKE_INSTALL_PREFIX=$BUILD_PREFIX -DCMAKE_INSTALL_NAME_DIR=$BUILD_PREFIX/lib . \
+ && make install)
+ if [[ "$MB_ML_LIBC" == "manylinux" ]]; then
+ cp /usr/local/lib64/libbrotli* /usr/local/lib
+ cp /usr/local/lib64/pkgconfig/libbrotli* /usr/local/lib/pkgconfig
+ fi
+}
+
+function pre_build {
+ # Any stuff that you need to do before you start building the wheels
+ # Runs in the root directory of this repository.
+ curl -fsSL -o pillow-depends-main.zip https://github.com/python-pillow/pillow-depends/archive/main.zip
+ untar pillow-depends-main.zip
+
+ build_xz
+ if [ -z "$IS_ALPINE" ] && [ -z "$IS_MACOS" ]; then
+ yum remove -y zlib-devel
+ fi
+ build_new_zlib
+
+ if [ -n "$IS_MACOS" ]; then
+ ORIGINAL_BUILD_PREFIX=$BUILD_PREFIX
+ ORIGINAL_PKG_CONFIG_PATH=$PKG_CONFIG_PATH
+ BUILD_PREFIX=`dirname $(dirname $(which python))`
+ PKG_CONFIG_PATH="$BUILD_PREFIX/lib/pkgconfig"
+ fi
+ build_simple xcb-proto 1.16.0 https://xorg.freedesktop.org/archive/individual/proto
+ if [ -n "$IS_MACOS" ]; then
+ 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 libpthread-stubs 0.5 https://xcb.freedesktop.org/dist
+ cp venv/share/pkgconfig/xcb-proto.pc venv/lib/pkgconfig/xcb-proto.pc
+ else
+ sed s/\${pc_sysrootdir\}// /usr/local/share/pkgconfig/xcb-proto.pc > /usr/local/lib/pkgconfig/xcb-proto.pc
+ fi
+ build_simple libxcb $LIBXCB_VERSION https://www.x.org/releases/individual/lib
+ if [ -n "$IS_MACOS" ]; then
+ BUILD_PREFIX=$ORIGINAL_BUILD_PREFIX
+ PKG_CONFIG_PATH=$ORIGINAL_PKG_CONFIG_PATH
+ fi
+
+ build_libjpeg_turbo
+ if [[ -n "$IS_MACOS" ]]; then
+ rm /usr/local/lib/libjpeg.dylib
+ fi
+ build_tiff
+ build_libpng
+ build_lcms2
+ build_openjpeg
+
+ ORIGINAL_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS -O3 -DNDEBUG"
+ if [[ -n "$IS_MACOS" ]]; then
+ CFLAGS="$CFLAGS -Wl,-headerpad_max_install_names"
+ fi
+ build_libwebp
+ CFLAGS=$ORIGINAL_CFLAGS
+
+ build_brotli
+
+ if [ -n "$IS_MACOS" ]; then
+ # Custom freetype build
+ build_simple freetype $FREETYPE_VERSION https://download.savannah.gnu.org/releases/freetype tar.gz --with-harfbuzz=no
+ else
+ build_freetype
+ fi
+
+ if [ -z "$IS_MACOS" ]; then
+ export FREETYPE_LIBS=-lfreetype
+ export FREETYPE_CFLAGS=-I/usr/local/include/freetype2/
+ fi
+ build_simple harfbuzz $HARFBUZZ_VERSION https://github.com/harfbuzz/harfbuzz/releases/download/$HARFBUZZ_VERSION tar.xz --with-freetype=yes --with-glib=no
+ if [ -z "$IS_MACOS" ]; then
+ export FREETYPE_LIBS=''
+ export FREETYPE_CFLAGS=''
+ fi
+
+ # Append licenses
+ for filename in wheels/dependency_licenses/*; do
+ echo -e "\n\n----\n\n$(basename $filename | cut -f 1 -d '.')\n" | cat >> LICENSE
+ cat $filename >> LICENSE
+ done
+}
+
+function pip_wheel_cmd {
+ local abs_wheelhouse=$1
+ if [ -z "$IS_MACOS" ]; then
+ CFLAGS="$CFLAGS --std=c99" # for Raqm
+ fi
+ python3 -m pip wheel $(pip_opts) \
+ -C raqm=enable -C raqm=vendor -C fribidi=vendor \
+ -w $abs_wheelhouse --no-deps .
+}
+
+function run_tests_in_repo {
+ # Run Pillow tests from within source repo
+ python3 selftest.py
+ python3 -m pytest
+}
+
+EXP_CODECS="jpg jpg_2000 libtiff zlib"
+EXP_MODULES="freetype2 littlecms2 pil tkinter webp"
+EXP_FEATURES="fribidi harfbuzz libjpeg_turbo raqm transp_webp webp_anim webp_mux xcb"
+
+function run_tests {
+ if [ -n "$IS_MACOS" ]; then
+ brew install fribidi
+ export PKG_CONFIG_PATH="/usr/local/opt/openblas/lib/pkgconfig"
+ elif [ -n "$IS_ALPINE" ]; then
+ apk add curl fribidi
+ else
+ apt-get update
+ apt-get install -y curl libfribidi0 libopenblas-dev pkg-config unzip
+ fi
+ if [ -z "$IS_ALPINE" ]; then
+ python3 -m pip install numpy
+ fi
+ python3 -m pip install defusedxml olefile pyroma
+
+ curl -fsSL -o pillow-test-images.zip https://github.com/python-pillow/test-images/archive/main.zip
+ untar pillow-test-images.zip
+ mv test-images-main/* ../Tests/images
+
+ # Runs tests on installed distribution from an empty directory
+ (cd .. && run_tests_in_repo)
+ # Test against expected codecs, modules and features
+ local ret=0
+ local codecs=$(python3 -c 'from PIL.features import *; print(" ".join(sorted(get_supported_codecs())))')
+ if [ "$codecs" != "$EXP_CODECS" ]; then
+ echo "Codecs should be: '$EXP_CODECS'; but are '$codecs'"
+ ret=1
+ fi
+ local modules=$(python3 -c 'from PIL.features import *; print(" ".join(sorted(get_supported_modules())))')
+ if [ "$modules" != "$EXP_MODULES" ]; then
+ echo "Modules should be: '$EXP_MODULES'; but are '$modules'"
+ ret=1
+ fi
+ local features=$(python3 -c 'from PIL.features import *; print(" ".join(sorted(get_supported_features())))')
+ if [ "$features" != "$EXP_FEATURES" ]; then
+ echo "Features should be: '$EXP_FEATURES'; but are '$features'"
+ ret=1
+ fi
+ return $ret
+}
diff --git a/wheels/dependency_licenses/BROTLI.txt b/wheels/dependency_licenses/BROTLI.txt
new file mode 100644
index 000000000..33b7cdd2d
--- /dev/null
+++ b/wheels/dependency_licenses/BROTLI.txt
@@ -0,0 +1,19 @@
+Copyright (c) 2009, 2010, 2013-2016 by the Brotli Authors.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/wheels/dependency_licenses/BZIP2.txt b/wheels/dependency_licenses/BZIP2.txt
new file mode 100644
index 000000000..d3edf477d
--- /dev/null
+++ b/wheels/dependency_licenses/BZIP2.txt
@@ -0,0 +1,42 @@
+
+--------------------------------------------------------------------------
+
+This program, "bzip2", the associated library "libbzip2", and all
+documentation, are copyright (C) 1996-2019 Julian R Seward. All
+rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. The origin of this software must not be misrepresented; you must
+ not claim that you wrote the original software. If you use this
+ software in a product, an acknowledgment in the product
+ documentation would be appreciated but is not required.
+
+3. Altered source versions must be plainly marked as such, and must
+ not be misrepresented as being the original software.
+
+4. The name of the author may not be used to endorse or promote
+ products derived from this software without specific prior written
+ permission.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS
+OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
+GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Julian Seward, jseward@acm.org
+bzip2/libbzip2 version 1.0.8 of 13 July 2019
+
+--------------------------------------------------------------------------
diff --git a/wheels/dependency_licenses/FREETYPE2.txt b/wheels/dependency_licenses/FREETYPE2.txt
new file mode 100644
index 000000000..cca8d8ce1
--- /dev/null
+++ b/wheels/dependency_licenses/FREETYPE2.txt
@@ -0,0 +1,40 @@
+The FreeType 2 font engine is copyrighted work and cannot be used
+legally without a software license. In order to make this project
+usable to a vast majority of developers, we distribute it under two
+mutually exclusive open-source licenses.
+
+This means that *you* must choose *one* of the two licenses described
+below, then obey all its terms and conditions when using FreeType 2 in
+any of your projects or products.
+
+ - The FreeType License, found in the file `docs/FTL.TXT`, which is
+ similar to the original BSD license *with* an advertising clause
+ that forces you to explicitly cite the FreeType project in your
+ product's documentation. All details are in the license file.
+ This license is suited to products which don't use the GNU General
+ Public License.
+
+ Note that this license is compatible to the GNU General Public
+ License version 3, but not version 2.
+
+ - The GNU General Public License version 2, found in
+ `docs/GPLv2.TXT` (any later version can be used also), for
+ programs which already use the GPL. Note that the FTL is
+ incompatible with GPLv2 due to its advertisement clause.
+
+The contributed BDF and PCF drivers come with a license similar to
+that of the X Window System. It is compatible to the above two
+licenses (see files `src/bdf/README` and `src/pcf/README`). The same
+holds for the source code files `src/base/fthash.c` and
+`include/freetype/internal/fthash.h`; they were part of the BDF driver
+in earlier FreeType versions.
+
+The gzip module uses the zlib license (see `src/gzip/zlib.h`) which
+too is compatible to the above two licenses.
+
+The files `src/autofit/ft-hb.c` and `src/autofit/ft-hb.h` contain code
+taken almost verbatim from the HarfBuzz file `hb-ft.cc`, which uses
+the 'Old MIT' license, compatible to the above two licenses.
+
+The MD5 checksum support (only used for debugging in development
+builds) is in the public domain.
diff --git a/wheels/dependency_licenses/HARFBUZZ.txt b/wheels/dependency_licenses/HARFBUZZ.txt
new file mode 100644
index 000000000..1dd917e9f
--- /dev/null
+++ b/wheels/dependency_licenses/HARFBUZZ.txt
@@ -0,0 +1,42 @@
+HarfBuzz is licensed under the so-called "Old MIT" license. Details follow.
+For parts of HarfBuzz that are licensed under different licenses see individual
+files names COPYING in subdirectories where applicable.
+
+Copyright © 2010-2022 Google, Inc.
+Copyright © 2015-2020 Ebrahim Byagowi
+Copyright © 2019,2020 Facebook, Inc.
+Copyright © 2012,2015 Mozilla Foundation
+Copyright © 2011 Codethink Limited
+Copyright © 2008,2010 Nokia Corporation and/or its subsidiary(-ies)
+Copyright © 2009 Keith Stribley
+Copyright © 2011 Martin Hosken and SIL International
+Copyright © 2007 Chris Wilson
+Copyright © 2005,2006,2020,2021,2022,2023 Behdad Esfahbod
+Copyright © 2004,2007,2008,2009,2010,2013,2021,2022,2023 Red Hat, Inc.
+Copyright © 1998-2005 David Turner and Werner Lemberg
+Copyright © 2016 Igalia S.L.
+Copyright © 2022 Matthias Clasen
+Copyright © 2018,2021 Khaled Hosny
+Copyright © 2018,2019,2020 Adobe, Inc
+Copyright © 2013-2015 Alexei Podtelezhnikov
+
+For full copyright notices consult the individual files in the package.
+
+
+Permission is hereby granted, without written agreement and without
+license or royalty fees, to use, copy, modify, and distribute this
+software and its documentation for any purpose, provided that the
+above copyright notice and the following two paragraphs appear in
+all copies of this software.
+
+IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGE.
+
+THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
+ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
diff --git a/wheels/dependency_licenses/LCMS2.txt b/wheels/dependency_licenses/LCMS2.txt
new file mode 100644
index 000000000..21ed6fb86
--- /dev/null
+++ b/wheels/dependency_licenses/LCMS2.txt
@@ -0,0 +1,8 @@
+Little CMS
+Copyright (c) 1998-2020 Marti Maria Saguer
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/wheels/dependency_licenses/LIBJPEG.txt b/wheels/dependency_licenses/LIBJPEG.txt
new file mode 100644
index 000000000..b5451f405
--- /dev/null
+++ b/wheels/dependency_licenses/LIBJPEG.txt
@@ -0,0 +1,43 @@
+1. We don't promise that this software works. (But if you find any bugs,
+ please let us know!)
+2. You can use this software for whatever you want. You don't have to pay us.
+3. You may not pretend that you wrote this software. If you use it in a
+ program, you must acknowledge somewhere in your documentation that
+ you've used the IJG code.
+
+In legalese:
+
+The authors make NO WARRANTY or representation, either express or implied,
+with respect to this software, its quality, accuracy, merchantability, or
+fitness for a particular purpose. This software is provided "AS IS", and you,
+its user, assume the entire risk as to its quality and accuracy.
+
+This software is copyright (C) 1991-2020, Thomas G. Lane, Guido Vollbeding.
+All Rights Reserved except as specified below.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+software (or portions thereof) for any purpose, without fee, subject to these
+conditions:
+(1) If any part of the source code for this software is distributed, then this
+README file must be included, with this copyright and no-warranty notice
+unaltered; and any additions, deletions, or changes to the original files
+must be clearly indicated in accompanying documentation.
+(2) If only executable code is distributed, then the accompanying
+documentation must state that "this software is based in part on the work of
+the Independent JPEG Group".
+(3) Permission for use of this software is granted only if the user accepts
+full responsibility for any undesirable consequences; the authors accept
+NO LIABILITY for damages of any kind.
+
+These conditions apply to any software derived from or based on the IJG code,
+not just to the unmodified library. If you use our work, you ought to
+acknowledge us.
+
+Permission is NOT granted for the use of any IJG author's name or company name
+in advertising or publicity relating to this software or products derived from
+it. This software may be referred to only as "the Independent JPEG Group's
+software".
+
+We specifically permit and encourage the use of this software as the basis of
+commercial products, provided that all warranty or liability claims are
+assumed by the product vendor.
diff --git a/wheels/dependency_licenses/LIBLZMA.txt b/wheels/dependency_licenses/LIBLZMA.txt
new file mode 100644
index 000000000..43c7a23ba
--- /dev/null
+++ b/wheels/dependency_licenses/LIBLZMA.txt
@@ -0,0 +1,63 @@
+XZ Utils Licensing
+==================
+
+ Different licenses apply to different files in this package. Here
+ is a rough summary of which licenses apply to which parts of this
+ package (but check the individual files to be sure!):
+
+ - liblzma is in the public domain.
+
+ - xz, xzdec, and lzmadec command line tools are in the public
+ domain unless GNU getopt_long had to be compiled and linked
+ in from the lib directory. The getopt_long code is under
+ GNU LGPLv2.1+.
+
+ - The scripts to grep, diff, and view compressed files have been
+ adapted from gzip. These scripts and their documentation are
+ under GNU GPLv2+.
+
+ - All the documentation in the doc directory and most of the
+ XZ Utils specific documentation files in other directories
+ are in the public domain.
+
+ - Translated messages are in the public domain.
+
+ - The build system contains public domain files, and files that
+ are under GNU GPLv2+ or GNU GPLv3+. None of these files end up
+ in the binaries being built.
+
+ - Test files and test code in the tests directory, and debugging
+ utilities in the debug directory are in the public domain.
+
+ - The extra directory may contain public domain files, and files
+ that are under various free software licenses.
+
+ You can do whatever you want with the files that have been put into
+ the public domain. If you find public domain legally problematic,
+ take the previous sentence as a license grant. If you still find
+ the lack of copyright legally problematic, you have too many
+ lawyers.
+
+ As usual, this software is provided "as is", without any warranty.
+
+ If you copy significant amounts of public domain code from XZ Utils
+ into your project, acknowledging this somewhere in your software is
+ polite (especially if it is proprietary, non-free software), but
+ naturally it is not legally required. Here is an example of a good
+ notice to put into "about box" or into documentation:
+
+ This software includes code from XZ Utils .
+
+ The following license texts are included in the following files:
+ - COPYING.LGPLv2.1: GNU Lesser General Public License version 2.1
+ - COPYING.GPLv2: GNU General Public License version 2
+ - COPYING.GPLv3: GNU General Public License version 3
+
+ Note that the toolchain (compiler, linker etc.) may add some code
+ pieces that are copyrighted. Thus, it is possible that e.g. liblzma
+ binary wouldn't actually be in the public domain in its entirety
+ even though it contains no copyrighted code from the XZ Utils source
+ package.
+
+ If you have questions, don't hesitate to ask the author(s) for more
+ information.
diff --git a/wheels/dependency_licenses/LIBPNG.txt b/wheels/dependency_licenses/LIBPNG.txt
new file mode 100644
index 000000000..c8ad24eec
--- /dev/null
+++ b/wheels/dependency_licenses/LIBPNG.txt
@@ -0,0 +1,134 @@
+COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
+=========================================
+
+PNG Reference Library License version 2
+---------------------------------------
+
+ * Copyright (c) 1995-2022 The PNG Reference Library Authors.
+ * Copyright (c) 2018-2022 Cosmin Truta.
+ * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
+ * Copyright (c) 1996-1997 Andreas Dilger.
+ * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
+
+The software is supplied "as is", without warranty of any kind,
+express or implied, including, without limitation, the warranties
+of merchantability, fitness for a particular purpose, title, and
+non-infringement. In no event shall the Copyright owners, or
+anyone distributing the software, be liable for any damages or
+other liability, whether in contract, tort or otherwise, arising
+from, out of, or in connection with the software, or the use or
+other dealings in the software, even if advised of the possibility
+of such damage.
+
+Permission is hereby granted to use, copy, modify, and distribute
+this software, or portions hereof, for any purpose, without fee,
+subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you
+ must not claim that you wrote the original software. If you
+ use this software in a product, an acknowledgment in the product
+ documentation would be appreciated, but is not required.
+
+ 2. Altered source versions must be plainly marked as such, and must
+ not be misrepresented as being the original software.
+
+ 3. This Copyright notice may not be removed or altered from any
+ source or altered source distribution.
+
+
+PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
+-----------------------------------------------------------------------
+
+libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are
+Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
+derived from libpng-1.0.6, and are distributed according to the same
+disclaimer and license as libpng-1.0.6 with the following individuals
+added to the list of Contributing Authors:
+
+ Simon-Pierre Cadieux
+ Eric S. Raymond
+ Mans Rullgard
+ Cosmin Truta
+ Gilles Vollant
+ James Yu
+ Mandar Sahastrabuddhe
+ Google Inc.
+ Vadim Barkov
+
+and with the following additions to the disclaimer:
+
+ There is no warranty against interference with your enjoyment of
+ the library or against infringement. There is no warranty that our
+ efforts or the library will fulfill any of your particular purposes
+ or needs. This library is provided with all faults, and the entire
+ risk of satisfactory quality, performance, accuracy, and effort is
+ with the user.
+
+Some files in the "contrib" directory and some configure-generated
+files that are distributed with libpng have other copyright owners, and
+are released under other open source licenses.
+
+libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
+Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
+libpng-0.96, and are distributed according to the same disclaimer and
+license as libpng-0.96, with the following individuals added to the
+list of Contributing Authors:
+
+ Tom Lane
+ Glenn Randers-Pehrson
+ Willem van Schaik
+
+libpng versions 0.89, June 1996, through 0.96, May 1997, are
+Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
+and are distributed according to the same disclaimer and license as
+libpng-0.88, with the following individuals added to the list of
+Contributing Authors:
+
+ John Bowler
+ Kevin Bracey
+ Sam Bushell
+ Magnus Holmgren
+ Greg Roelofs
+ Tom Tanner
+
+Some files in the "scripts" directory have other copyright owners,
+but are released under this license.
+
+libpng versions 0.5, May 1995, through 0.88, January 1996, are
+Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
+
+For the purposes of this copyright and license, "Contributing Authors"
+is defined as the following set of individuals:
+
+ Andreas Dilger
+ Dave Martindale
+ Guy Eric Schalnat
+ Paul Schmidt
+ Tim Wegner
+
+The PNG Reference Library is supplied "AS IS". The Contributing
+Authors and Group 42, Inc. disclaim all warranties, expressed or
+implied, including, without limitation, the warranties of
+merchantability and of fitness for any purpose. The Contributing
+Authors and Group 42, Inc. assume no liability for direct, indirect,
+incidental, special, exemplary, or consequential damages, which may
+result from the use of the PNG Reference Library, even if advised of
+the possibility of such damage.
+
+Permission is hereby granted to use, copy, modify, and distribute this
+source code, or portions hereof, for any purpose, without fee, subject
+to the following restrictions:
+
+ 1. The origin of this source code must not be misrepresented.
+
+ 2. Altered versions must be plainly marked as such and must not
+ be misrepresented as being the original source.
+
+ 3. This Copyright notice may not be removed or altered from any
+ source or altered source distribution.
+
+The Contributing Authors and Group 42, Inc. specifically permit,
+without fee, and encourage the use of this source code as a component
+to supporting the PNG file format in commercial products. If you use
+this source code in a product, acknowledgment is not required but would
+be appreciated.
diff --git a/wheels/dependency_licenses/LIBTIFF.txt b/wheels/dependency_licenses/LIBTIFF.txt
new file mode 100644
index 000000000..dc255dec6
--- /dev/null
+++ b/wheels/dependency_licenses/LIBTIFF.txt
@@ -0,0 +1,21 @@
+Copyright (c) 1988-1997 Sam Leffler
+Copyright (c) 1991-1997 Silicon Graphics, Inc.
+
+Permission to use, copy, modify, distribute, and sell this software and
+its documentation for any purpose is hereby granted without fee, provided
+that (i) the above copyright notices and this permission notice appear in
+all copies of the software and related documentation, and (ii) the names of
+Sam Leffler and Silicon Graphics may not be used in any advertising or
+publicity relating to the software without the specific, prior written
+permission of Sam Leffler and Silicon Graphics.
+
+THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
+ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
+OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
+LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
+OF THIS SOFTWARE.
diff --git a/wheels/dependency_licenses/LIBWEBP.txt b/wheels/dependency_licenses/LIBWEBP.txt
new file mode 100644
index 000000000..83e4e6f6d
--- /dev/null
+++ b/wheels/dependency_licenses/LIBWEBP.txt
@@ -0,0 +1,29 @@
+Copyright (c) 2010, Google Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the
+ distribution.
+
+ * Neither the name of Google nor the names of its contributors may
+ be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
diff --git a/wheels/dependency_licenses/OPENJPEG.txt b/wheels/dependency_licenses/OPENJPEG.txt
new file mode 100644
index 000000000..c41fc21d8
--- /dev/null
+++ b/wheels/dependency_licenses/OPENJPEG.txt
@@ -0,0 +1,39 @@
+*
+ * The copyright in this software is being made available under the 2-clauses
+ * BSD License, included below. This software may be subject to other third
+ * party and contributor rights, including patent rights, and no such rights
+ * are granted under this license.
+ *
+ * Copyright (c) 2002-2014, Universite catholique de Louvain (UCL), Belgium
+ * Copyright (c) 2002-2014, Professor Benoit Macq
+ * Copyright (c) 2003-2014, Antonin Descampe
+ * Copyright (c) 2003-2009, Francois-Olivier Devaux
+ * Copyright (c) 2005, Herve Drolon, FreeImage Team
+ * Copyright (c) 2002-2003, Yannick Verschueren
+ * Copyright (c) 2001-2003, David Janssens
+ * Copyright (c) 2011-2012, Centre National d'Etudes Spatiales (CNES), France
+ * Copyright (c) 2012, CS Systemes d'Information, France
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
diff --git a/wheels/dependency_licenses/RAQM.txt b/wheels/dependency_licenses/RAQM.txt
new file mode 100644
index 000000000..196511ef6
--- /dev/null
+++ b/wheels/dependency_licenses/RAQM.txt
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright © 2015 Information Technology Authority (ITA)
+Copyright © 2016 Khaled Hosny
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/wheels/dependency_licenses/XAU.txt b/wheels/dependency_licenses/XAU.txt
new file mode 100644
index 000000000..64492ad80
--- /dev/null
+++ b/wheels/dependency_licenses/XAU.txt
@@ -0,0 +1,21 @@
+Copyright 1988, 1993, 1994, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
diff --git a/wheels/dependency_licenses/XCB.txt b/wheels/dependency_licenses/XCB.txt
new file mode 100644
index 000000000..54bfbe5b0
--- /dev/null
+++ b/wheels/dependency_licenses/XCB.txt
@@ -0,0 +1,30 @@
+Copyright (C) 2001-2006 Bart Massey, Jamey Sharp, and Josh Triplett.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated
+documentation files (the "Software"), to deal in the
+Software without restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute,
+sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall
+be included in all copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the names of the authors
+or their institutions shall not be used in advertising or
+otherwise to promote the sale, use or other dealings in this
+Software without prior written authorization from the
+authors.
diff --git a/wheels/dependency_licenses/XDMCP.txt b/wheels/dependency_licenses/XDMCP.txt
new file mode 100644
index 000000000..5532d143c
--- /dev/null
+++ b/wheels/dependency_licenses/XDMCP.txt
@@ -0,0 +1,23 @@
+Copyright 1989, 1998 The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation.
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be
+used in advertising or otherwise to promote the sale, use or other dealings
+in this Software without prior written authorization from The Open Group.
+
+Author: Keith Packard, MIT X Consortium
diff --git a/wheels/dependency_licenses/ZLIB.txt b/wheels/dependency_licenses/ZLIB.txt
new file mode 100644
index 000000000..84def6dc6
--- /dev/null
+++ b/wheels/dependency_licenses/ZLIB.txt
@@ -0,0 +1,29 @@
+ (C) 1995-2017 Jean-loup Gailly and Mark Adler
+
+ This software is provided 'as-is', without any express or implied
+ warranty. In no event will the authors be held liable for any damages
+ arising from the use of this software.
+
+ Permission is granted to anyone to use this software for any purpose,
+ including commercial applications, and to alter it and redistribute it
+ freely, subject to the following restrictions:
+
+ 1. The origin of this software must not be misrepresented; you must not
+ claim that you wrote the original software. If you use this software
+ in a product, an acknowledgment in the product documentation would be
+ appreciated but is not required.
+ 2. Altered source versions must be plainly marked as such, and must not be
+ misrepresented as being the original software.
+ 3. This notice may not be removed or altered from any source distribution.
+
+ Jean-loup Gailly Mark Adler
+ jloup@gzip.org madler@alumni.caltech.edu
+
+If you use the zlib library in a product, we would appreciate *not* receiving
+lengthy legal documents to sign. The sources are provided for free but without
+warranty of any kind. The library has been entirely written by Jean-loup
+Gailly and Mark Adler; it does not include third-party code.
+
+If you redistribute modified sources, we would appreciate that you include in
+the file ChangeLog history information documenting your changes. Please read
+the FAQ for more information on the distribution of modified source versions.
diff --git a/wheels/multibuild b/wheels/multibuild
new file mode 160000
index 000000000..452dd2d17
--- /dev/null
+++ b/wheels/multibuild
@@ -0,0 +1 @@
+Subproject commit 452dd2d1705f6b2375369a6570c415beb3163f70
diff --git a/winbuild/build_prepare.py b/winbuild/build_prepare.py
index d9122e680..3b85ff8d7 100644
--- a/winbuild/build_prepare.py
+++ b/winbuild/build_prepare.py
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
import argparse
import os
import platform
@@ -7,42 +9,41 @@ import struct
import subprocess
-def cmd_cd(path):
+def cmd_cd(path: str) -> str:
return f"cd /D {path}"
-def cmd_set(name, value):
+def cmd_set(name: str, value: str) -> str:
return f"set {name}={value}"
-def cmd_append(name, value):
+def cmd_append(name: str, value: str) -> str:
op = "path " if name == "PATH" else f"set {name}="
return op + f"%{name}%;{value}"
-def cmd_copy(src, tgt):
+def cmd_copy(src: str, tgt: str) -> str:
return f'copy /Y /B "{src}" "{tgt}"'
-def cmd_xcopy(src, tgt):
+def cmd_xcopy(src: str, tgt: str) -> str:
return f'xcopy /Y /E "{src}" "{tgt}"'
-def cmd_mkdir(path):
+def cmd_mkdir(path: str) -> str:
return f'mkdir "{path}"'
-def cmd_rmdir(path):
+def cmd_rmdir(path: str) -> str:
return f'rmdir /S /Q "{path}"'
-def cmd_nmake(makefile=None, target="", params=None):
- if params is None:
- params = ""
- elif isinstance(params, (list, tuple)):
- params = " ".join(params)
- else:
- params = str(params)
+def cmd_nmake(
+ makefile: str | None = None,
+ target: str = "",
+ params: list[str] | None = None,
+) -> str:
+ params = "" if params is None else " ".join(params)
return " ".join(
[
@@ -55,7 +56,7 @@ def cmd_nmake(makefile=None, target="", params=None):
)
-def cmds_cmake(target, *params):
+def cmds_cmake(target: str | tuple[str, ...] | list[str], *params) -> list[str]:
if not isinstance(target, str):
target = " ".join(target)
@@ -80,8 +81,11 @@ def cmds_cmake(target, *params):
def cmd_msbuild(
- file, configuration="Release", target="Build", platform="{msbuild_arch}"
-):
+ file: str,
+ configuration: str = "Release",
+ target: str = "Build",
+ platform: str = "{msbuild_arch}",
+) -> str:
return " ".join(
[
"{msbuild}",
@@ -96,14 +100,14 @@ def cmd_msbuild(
SF_PROJECTS = "https://sourceforge.net/projects"
-architectures = {
+ARCHITECTURES = {
"x86": {"vcvars_arch": "x86", "msbuild_arch": "Win32"},
"x64": {"vcvars_arch": "x86_amd64", "msbuild_arch": "x64"},
"ARM64": {"vcvars_arch": "x86_arm64", "msbuild_arch": "ARM64"},
}
# dependencies, listed in order of compilation
-deps = {
+DEPS = {
"libjpeg": {
"url": SF_PROJECTS
+ "/libjpeg-turbo/files/3.0.0/libjpeg-turbo-3.0.0.tar.gz/download",
@@ -335,9 +339,9 @@ deps = {
"libs": [r"imagequant.lib"],
},
"harfbuzz": {
- "url": "https://github.com/harfbuzz/harfbuzz/archive/8.2.0.zip",
- "filename": "harfbuzz-8.2.0.zip",
- "dir": "harfbuzz-8.2.0",
+ "url": "https://github.com/harfbuzz/harfbuzz/archive/8.2.1.zip",
+ "filename": "harfbuzz-8.2.1.zip",
+ "dir": "harfbuzz-8.2.1",
"license": "COPYING",
"build": [
*cmds_cmake(
@@ -365,7 +369,7 @@ deps = {
# based on distutils._msvccompiler from CPython 3.7.4
-def find_msvs():
+def find_msvs() -> dict[str, str] | None:
root = os.environ.get("ProgramFiles(x86)") or os.environ.get("ProgramFiles")
if not root:
print("Program Files not found")
@@ -421,25 +425,40 @@ def find_msvs():
}
-def extract_dep(url, filename):
- import tarfile
+def download_dep(url: str, file: str) -> None:
import urllib.request
+
+ ex = None
+ for i in range(3):
+ try:
+ print(f"Fetching {url} (attempt {i + 1})...")
+ content = urllib.request.urlopen(url).read()
+ with open(file, "wb") as f:
+ f.write(content)
+ break
+ except urllib.error.URLError as e:
+ ex = e
+ else:
+ raise RuntimeError(ex)
+
+
+def extract_dep(url: str, filename: str) -> None:
+ import tarfile
import zipfile
file = os.path.join(args.depends_dir, filename)
if not os.path.exists(file):
- ex = None
- for i in range(3):
- try:
- print("Fetching %s (attempt %d)..." % (url, i + 1))
- content = urllib.request.urlopen(url).read()
- with open(file, "wb") as f:
- f.write(content)
- break
- except urllib.error.URLError as e:
- ex = e
- else:
- raise RuntimeError(ex)
+ # First try our mirror
+ mirror_url = (
+ f"https://raw.githubusercontent.com/"
+ f"python-pillow/pillow-depends/main/{filename}"
+ )
+ try:
+ download_dep(mirror_url, file)
+ except RuntimeError as exc:
+ # Otherwise try upstream
+ print(exc)
+ download_dep(url, file)
print("Extracting " + filename)
sources_dir_abs = os.path.abspath(sources_dir)
@@ -466,7 +485,7 @@ def extract_dep(url, filename):
raise RuntimeError(msg)
-def write_script(name, lines):
+def write_script(name: str, lines: list[str]) -> None:
name = os.path.join(args.build_dir, name)
lines = [line.format(**prefs) for line in lines]
print("Writing " + name)
@@ -477,7 +496,7 @@ def write_script(name, lines):
print(" " + line)
-def get_footer(dep):
+def get_footer(dep: dict) -> list[str]:
lines = []
for out in dep.get("headers", []):
lines.append(cmd_copy(out, "{inc_dir}"))
@@ -488,7 +507,7 @@ def get_footer(dep):
return lines
-def build_env():
+def build_env() -> None:
lines = [
"if defined DISTUTILS_USE_SDK goto end",
cmd_set("INCLUDE", "{inc_dir}"),
@@ -504,8 +523,8 @@ def build_env():
write_script("build_env.cmd", lines)
-def build_dep(name):
- dep = deps[name]
+def build_dep(name: str) -> str:
+ dep = DEPS[name]
dir = dep["dir"]
file = f"build_dep_{name}.cmd"
@@ -554,9 +573,9 @@ def build_dep(name):
return file
-def build_dep_all():
+def build_dep_all() -> None:
lines = [r'call "{build_dir}\build_env.cmd"']
- for dep_name in deps:
+ for dep_name in DEPS:
print()
if dep_name in disabled:
print(f"Skipping disabled dependency {dep_name}")
@@ -602,7 +621,7 @@ if __name__ == "__main__":
)
parser.add_argument(
"--architecture",
- choices=architectures,
+ choices=ARCHITECTURES,
default=os.environ.get(
"ARCHITECTURE",
(
@@ -634,7 +653,7 @@ if __name__ == "__main__":
)
args = parser.parse_args()
- arch_prefs = architectures[args.architecture]
+ arch_prefs = ARCHITECTURES[args.architecture]
print("Target architecture:", args.architecture)
msvs = find_msvs()
@@ -693,7 +712,7 @@ if __name__ == "__main__":
# TODO find NASM automatically
}
- for k, v in deps.items():
+ for k, v in DEPS.items():
prefs[f"dir_{k}"] = os.path.join(sources_dir, v["dir"])
print()