mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Merge branch 'master' into update-releasing
This commit is contained in:
commit
036d90cc48
|
@ -1,5 +1,4 @@
|
|||
version: '{build}'
|
||||
image: Visual Studio 2017
|
||||
clone_folder: c:\pillow
|
||||
init:
|
||||
- ECHO %PYTHON%
|
||||
|
@ -8,21 +7,22 @@ init:
|
|||
|
||||
environment:
|
||||
EXECUTABLE: python.exe
|
||||
PIP_DIR: Scripts
|
||||
TEST_OPTIONS:
|
||||
DEPLOY: YES
|
||||
matrix:
|
||||
- PYTHON: C:/Python38
|
||||
- PYTHON: C:/Python39
|
||||
ARCHITECTURE: x86
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
- PYTHON: C:/Python36-x64
|
||||
ARCHITECTURE: x64
|
||||
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
|
||||
|
||||
install:
|
||||
- curl -fsSL -o pillow-depends.zip https://github.com/python-pillow/pillow-depends/archive/master.zip
|
||||
- 7z x pillow-depends.zip -oc:\
|
||||
- mv c:\pillow-depends-master c:\pillow-depends
|
||||
- xcopy /s c:\pillow-depends\test_images\* c:\pillow\tests\images
|
||||
- xcopy /S /Y c:\pillow-depends\test_images\* c:\pillow\tests\images
|
||||
- 7z x ..\pillow-depends\nasm-2.14.02-win64.zip -oc:\
|
||||
- ..\pillow-depends\gs9533w32.exe /S
|
||||
- path c:\nasm-2.14.02;C:\Program Files (x86)\gs\gs9.53.3\bin;%PATH%
|
||||
|
@ -32,6 +32,7 @@ install:
|
|||
c:\pillow\winbuild\build\build_dep_all.cmd
|
||||
$host.SetShouldExit(0)
|
||||
- path C:\pillow\winbuild\build\bin;%PATH%
|
||||
- '%PYTHON%\%EXECUTABLE% -m pip install -U "setuptools>=49.3.2"'
|
||||
|
||||
build_script:
|
||||
- ps: |
|
||||
|
@ -42,13 +43,13 @@ build_script:
|
|||
|
||||
test_script:
|
||||
- cd c:\pillow
|
||||
- '%PYTHON%\%PIP_DIR%\pip.exe install pytest pytest-cov'
|
||||
- '%PYTHON%\%EXECUTABLE% -m pip install pytest pytest-cov'
|
||||
- c:\"Program Files (x86)"\"Windows Kits"\10\Debuggers\x86\gflags.exe /p /enable %PYTHON%\%EXECUTABLE%
|
||||
- '%PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests'
|
||||
#- '%PYTHON%\%EXECUTABLE% test-installed.py -v -s %TEST_OPTIONS%' TODO TEST_OPTIONS with pytest?
|
||||
|
||||
after_test:
|
||||
- pip install codecov
|
||||
- python -m pip install codecov
|
||||
- codecov --file coverage.xml --name %PYTHON% --flags AppVeyor
|
||||
|
||||
matrix:
|
||||
|
@ -65,7 +66,7 @@ artifacts:
|
|||
|
||||
before_deploy:
|
||||
- cd c:\pillow
|
||||
- '%PYTHON%\%PIP_DIR%\pip.exe install wheel'
|
||||
- '%PYTHON%\%EXECUTABLE% -m pip install wheel'
|
||||
- cd c:\pillow\winbuild\
|
||||
- c:\pillow\winbuild\build\build_pillow.cmd bdist_wheel
|
||||
- cd c:\pillow
|
||||
|
|
|
@ -12,7 +12,7 @@ if [[ $TRAVIS ]]; then
|
|||
codecov --flags TravisCI
|
||||
fi
|
||||
|
||||
if [ "$TRAVIS_PYTHON_VERSION" == "3.8" ]; then
|
||||
if [ "$TRAVIS_PYTHON_VERSION" == "3.9" ]; then
|
||||
# Coverage and quality reports on just the latest diff.
|
||||
depends/diffcover-install.sh
|
||||
depends/diffcover-run.sh
|
||||
|
|
|
@ -21,34 +21,35 @@ sudo apt-get -qq install libfreetype6-dev liblcms2-dev python3-tk\
|
|||
ghostscript libffi-dev libjpeg-turbo-progs libopenjp2-7-dev\
|
||||
cmake imagemagick libharfbuzz-dev libfribidi-dev
|
||||
|
||||
if [[ $TRAVIS_CPU_ARCH == "s390x" || $TRAVIS_CPU_ARCH == "ppc64le" ]]; then sudo chown $USER ~/.cache/pip/wheels ; fi
|
||||
if [[ $TRAVIS_CPU_ARCH == "s390x" ]]; then sudo chown $USER ~/.cache/pip/wheels ; fi
|
||||
|
||||
pip install --upgrade pip
|
||||
PYTHONOPTIMIZE=0 pip install cffi
|
||||
pip install coverage
|
||||
pip install olefile
|
||||
pip install -U pytest
|
||||
pip install -U pytest-cov
|
||||
pip install pyroma
|
||||
pip install test-image-results
|
||||
pip install numpy
|
||||
python3 -m pip install --upgrade pip
|
||||
PYTHONOPTIMIZE=0 python3 -m pip install cffi
|
||||
python3 -m pip install coverage
|
||||
python3 -m pip install olefile
|
||||
python3 -m pip install -U pytest
|
||||
python3 -m pip install -U pytest-cov
|
||||
python3 -m pip install pyroma
|
||||
python3 -m pip install test-image-results
|
||||
# TODO Remove condition when numpy supports 3.10
|
||||
if ! [ "$GHA_PYTHON_VERSION" == "3.10-dev" ]; then python3 -m pip install numpy ; fi
|
||||
|
||||
# TODO Remove when 3.8 / 3.9 / PyPy3 includes setuptools 49.3.2+:
|
||||
if [ "$GHA_PYTHON_VERSION" == "3.8" ]; then pip install -U "setuptools>=49.3.2" ; fi
|
||||
if [ "$GHA_PYTHON_VERSION" == "3.9" ]; then pip install -U "setuptools>=49.3.2" ; fi
|
||||
if [ "$TRAVIS_PYTHON_VERSION" == "pypy3.6-7.3.1" ]; then pip install -U "setuptools>=49.3.2" ; fi
|
||||
if [ "$GHA_PYTHON_VERSION" == "3.8" ]; then python3 -m pip install -U "setuptools>=49.3.2" ; fi
|
||||
if [ "$GHA_PYTHON_VERSION" == "3.9" ]; then python3 -m pip install -U "setuptools>=49.3.2" ; fi
|
||||
if [ "$TRAVIS_PYTHON_VERSION" == "pypy3.6-7.3.1" ]; then python3 -m pip install -U "setuptools>=49.3.2" ; fi
|
||||
|
||||
if [[ $TRAVIS_PYTHON_VERSION == 3.* ]]; then
|
||||
# PyQt5 doesn't support PyPy3
|
||||
# Wheel doesn't yet support 3.10
|
||||
if [[ $GHA_PYTHON_VERSION == 3.* && $GHA_PYTHON_VERSION != "3.10-dev" ]]; then
|
||||
# arm64, ppc64le, s390x CPUs:
|
||||
# "ERROR: Could not find a version that satisfies the requirement pyqt5"
|
||||
if [[ $TRAVIS_CPU_ARCH == "amd64" ]]; then
|
||||
sudo apt-get -qq install libxcb-xinerama0 pyqt5-dev-tools
|
||||
pip install pyqt5
|
||||
fi
|
||||
python3 -m pip install pyqt5
|
||||
fi
|
||||
|
||||
# docs only on Python 3.8
|
||||
if [ "$TRAVIS_PYTHON_VERSION" == "3.8" ]; then pip install -r requirements.txt ; fi
|
||||
# docs only on Python 3.9
|
||||
if [ "$TRAVIS_PYTHON_VERSION" == "3.9" ]; then python3 -m pip install -r requirements.txt ; fi
|
||||
|
||||
# webp
|
||||
pushd depends && ./install_webp.sh && popd
|
||||
|
|
|
@ -5,6 +5,6 @@ set -e
|
|||
python -bb -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term Tests
|
||||
|
||||
# Docs
|
||||
if [ "$TRAVIS_PYTHON_VERSION" == "3.8" ] && [ "$TRAVIS_CPU_ARCH" == "amd64" ]; then
|
||||
if [ "$TRAVIS_PYTHON_VERSION" == "3.9" ] && [ "$TRAVIS_CPU_ARCH" == "amd64" ]; then
|
||||
make doccheck
|
||||
fi
|
||||
|
|
4
.github/CONTRIBUTING.md
vendored
4
.github/CONTRIBUTING.md
vendored
|
@ -9,7 +9,7 @@ Please send a pull request to the master branch. Please include [documentation](
|
|||
- Fork the Pillow repository.
|
||||
- Create a branch from master.
|
||||
- Develop bug fixes, features, tests, etc.
|
||||
- Run the test suite. You can enable [Travis CI](https://travis-ci.org/profile/) and [AppVeyor](https://ci.appveyor.com/projects/new) on your repo to catch test failures prior to the pull request, and [Codecov](https://codecov.io/gh) to see if the changed code is covered by tests.
|
||||
- Run the test suite. You can enable [Travis CI](https://travis-ci.com/account/repositories) and [AppVeyor](https://ci.appveyor.com/projects/new) on your repo to catch test failures prior to the pull request, and [Codecov](https://codecov.io/gh) to see if the changed code is covered by tests.
|
||||
- Create a pull request to pull the changes from your branch to the Pillow master.
|
||||
|
||||
### Guidelines
|
||||
|
@ -17,7 +17,7 @@ Please send a pull request to the master branch. Please include [documentation](
|
|||
- Separate code commits from reformatting commits.
|
||||
- Provide tests for any newly added code.
|
||||
- Follow PEP 8.
|
||||
- When committing only documentation changes please include [ci skip] in the commit message to avoid running tests on Travis-CI and AppVeyor.
|
||||
- When committing only documentation changes please include `[ci skip]` in the commit message to avoid running tests on Travis CI and AppVeyor.
|
||||
|
||||
## Reporting Issues
|
||||
|
||||
|
|
2
.github/mergify.yml
vendored
2
.github/mergify.yml
vendored
|
@ -7,8 +7,8 @@ pull_request_rules:
|
|||
- status-success=Test Successful
|
||||
- status-success=Docker Test Successful
|
||||
- status-success=Windows Test Successful
|
||||
- status-success=Travis CI - Pull Request
|
||||
- status-success=continuous-integration/appveyor/pr
|
||||
- status-success=continuous-integration/travis-ci/pr
|
||||
actions:
|
||||
merge:
|
||||
method: merge
|
||||
|
|
14
.github/release-drafter.yml
vendored
Normal file
14
.github/release-drafter.yml
vendored
Normal file
|
@ -0,0 +1,14 @@
|
|||
name-template: "$NEXT_MINOR_VERSION"
|
||||
tag-template: "$NEXT_MINOR_VERSION"
|
||||
change-template: '- $TITLE #$NUMBER [@$AUTHOR]'
|
||||
|
||||
exclude-labels:
|
||||
- "changelog: skip"
|
||||
|
||||
template: |
|
||||
|
||||
https://pillow.readthedocs.io/en/stable/releasenotes/$NEXT_MINOR_VERSION.html
|
||||
|
||||
## Changes
|
||||
|
||||
$CHANGES
|
23
.github/workflows/macos-install.sh
vendored
23
.github/workflows/macos-install.sh
vendored
|
@ -2,22 +2,23 @@
|
|||
|
||||
set -e
|
||||
|
||||
brew install libtiff libjpeg openjpeg libimagequant webp little-cms2 freetype openblas
|
||||
brew install libtiff libjpeg openjpeg libimagequant webp little-cms2 freetype openblas libraqm
|
||||
|
||||
PYTHONOPTIMIZE=0 pip install cffi
|
||||
pip install coverage
|
||||
pip install olefile
|
||||
pip install -U pytest
|
||||
pip install -U pytest-cov
|
||||
pip install pyroma
|
||||
pip install test-image-results
|
||||
PYTHONOPTIMIZE=0 python3 -m pip install cffi
|
||||
python3 -m pip install coverage
|
||||
python3 -m pip install olefile
|
||||
python3 -m pip install -U pytest
|
||||
python3 -m pip install -U pytest-cov
|
||||
python3 -m pip install pyroma
|
||||
python3 -m pip install test-image-results
|
||||
|
||||
echo -e "[openblas]\nlibraries = openblas\nlibrary_dirs = /usr/local/opt/openblas/lib" >> ~/.numpy-site.cfg
|
||||
pip install numpy
|
||||
# TODO Remove condition when numpy supports 3.10
|
||||
if ! [ "$GHA_PYTHON_VERSION" == "3.10-dev" ]; then python3 -m pip install numpy ; fi
|
||||
|
||||
# TODO Remove when 3.8 / 3.9 includes setuptools 49.3.2+:
|
||||
if [ "$GHA_PYTHON_VERSION" == "3.8" ]; then pip install -U "setuptools>=49.3.2" ; fi
|
||||
if [ "$GHA_PYTHON_VERSION" == "3.9" ]; then pip install -U "setuptools>=49.3.2" ; fi
|
||||
if [ "$GHA_PYTHON_VERSION" == "3.8" ]; then python3 -m pip install -U "setuptools>=49.3.2" ; fi
|
||||
if [ "$GHA_PYTHON_VERSION" == "3.9" ]; then python3 -m pip install -U "setuptools>=49.3.2" ; fi
|
||||
|
||||
# extra test images
|
||||
pushd depends && ./install_extra_test_images.sh && popd
|
||||
|
|
17
.github/workflows/release-drafter.yml
vendored
Normal file
17
.github/workflows/release-drafter.yml
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
name: Release drafter
|
||||
|
||||
on:
|
||||
push:
|
||||
# branches to consider in the event; optional, defaults to all
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
update_release_draft:
|
||||
if: github.repository == 'python-pillow/Pillow'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Drafts your next release notes as pull requests are merged into "master"
|
||||
- uses: release-drafter/release-drafter@v5
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
12
.github/workflows/test-docker.yml
vendored
12
.github/workflows/test-docker.yml
vendored
|
@ -11,17 +11,15 @@ jobs:
|
|||
matrix:
|
||||
docker: [
|
||||
alpine,
|
||||
amazon-2-amd64,
|
||||
arch,
|
||||
ubuntu-18.04-bionic-amd64,
|
||||
ubuntu-20.04-focal-amd64,
|
||||
debian-10-buster-x86,
|
||||
centos-6-amd64,
|
||||
centos-7-amd64,
|
||||
centos-8-amd64,
|
||||
amazon-1-amd64,
|
||||
amazon-2-amd64,
|
||||
fedora-31-amd64,
|
||||
debian-10-buster-x86,
|
||||
fedora-32-amd64,
|
||||
fedora-33-amd64,
|
||||
ubuntu-18.04-bionic-amd64,
|
||||
ubuntu-20.04-focal-amd64,
|
||||
]
|
||||
dockerTag: [master]
|
||||
|
||||
|
|
32
.github/workflows/test-windows.yml
vendored
32
.github/workflows/test-windows.yml
vendored
|
@ -8,7 +8,7 @@ jobs:
|
|||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.6", "3.7", "3.8", "3.9", "pypy3"]
|
||||
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10-dev", "pypy3"]
|
||||
architecture: ["x86", "x64"]
|
||||
include:
|
||||
- architecture: "x86"
|
||||
|
@ -52,15 +52,10 @@ jobs:
|
|||
python-version: ${{ matrix.python-version }}
|
||||
architecture: ${{ matrix.architecture }}
|
||||
|
||||
- name: Set up TCL
|
||||
if: "contains(matrix.python-version, 'pypy')"
|
||||
run: echo "TCL_LIBRARY=$env:pythonLocation\tcl\tcl8.5" >> $env:GITHUB_ENV
|
||||
shell: pwsh
|
||||
|
||||
- name: Print build system information
|
||||
run: python .github/workflows/system-info.py
|
||||
|
||||
- name: pip install wheel pytest pytest-cov
|
||||
- name: python -m pip install wheel pytest pytest-cov
|
||||
run: python -m pip install wheel pytest pytest-cov
|
||||
|
||||
# TODO Remove when 3.8 / 3.9 includes setuptools 49.3.2+:
|
||||
|
@ -69,6 +64,7 @@ jobs:
|
|||
run: python -m pip install -U "setuptools>=49.3.2"
|
||||
|
||||
- name: Install dependencies
|
||||
id: install
|
||||
run: |
|
||||
7z x winbuild\depends\nasm-2.14.02-win64.zip "-o$env:RUNNER_WORKSPACE\"
|
||||
echo "$env:RUNNER_WORKSPACE\nasm-2.14.02" >> $env:GITHUB_PATH
|
||||
|
@ -76,7 +72,10 @@ jobs:
|
|||
winbuild\depends\gs9533w32.exe /S
|
||||
echo "C:\Program Files (x86)\gs\gs9.53.3\bin" >> $env:GITHUB_PATH
|
||||
|
||||
xcopy /s winbuild\depends\test_images\* Tests\images\
|
||||
xcopy /S /Y winbuild\depends\test_images\* Tests\images\
|
||||
|
||||
# make cache key depend on VS version
|
||||
& "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" | find """catalog_buildVersion""" | ForEach-Object { $a = $_.split(" ")[1]; echo "::set-output name=vs::$a" }
|
||||
shell: pwsh
|
||||
|
||||
- name: Cache build
|
||||
|
@ -85,7 +84,7 @@ jobs:
|
|||
with:
|
||||
path: winbuild\build
|
||||
key:
|
||||
${{ hashFiles('winbuild\build_prepare.py') }}-${{ hashFiles('.github\workflows\test-windows.yml') }}-${{ env.pythonLocation }}
|
||||
${{ hashFiles('winbuild\build_prepare.py') }}-${{ hashFiles('.github\workflows\test-windows.yml') }}-${{ env.pythonLocation }}-${{ steps.install.outputs.vs }}
|
||||
|
||||
- name: Prepare build
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
|
@ -96,25 +95,32 @@ jobs:
|
|||
- name: Build dependencies / libjpeg-turbo
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_libjpeg.cmd"
|
||||
|
||||
- name: Build dependencies / zlib
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_zlib.cmd"
|
||||
|
||||
- name: Build dependencies / LibTiff
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_libtiff.cmd"
|
||||
|
||||
- name: Build dependencies / WebP
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_libwebp.cmd"
|
||||
|
||||
# for FreeType CBDT font support
|
||||
- name: Build dependencies / libpng
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_libpng.cmd"
|
||||
|
||||
- name: Build dependencies / FreeType
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_freetype.cmd"
|
||||
|
||||
- name: Build dependencies / LCMS2
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_lcms2.cmd"
|
||||
|
||||
- name: Build dependencies / OpenJPEG
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_openjpeg.cmd"
|
||||
|
@ -128,9 +134,11 @@ jobs:
|
|||
- name: Build dependencies / HarfBuzz
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_harfbuzz.cmd"
|
||||
|
||||
- name: Build dependencies / FriBidi
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_fribidi.cmd"
|
||||
|
||||
- name: Build dependencies / Raqm
|
||||
if: steps.build-cache.outputs.cache-hit != 'true'
|
||||
run: "& winbuild\\build\\build_dep_libraqm.cmd"
|
||||
|
@ -187,14 +195,16 @@ jobs:
|
|||
|
||||
- name: Build wheel
|
||||
id: wheel
|
||||
if: "github.event_name == 'push'"
|
||||
# Skip wheels on 3.10 due to https://github.com/pypa/wheel/issues/354
|
||||
if: "github.event_name == 'push' && !contains(matrix.python-version, '3.10')"
|
||||
run: |
|
||||
for /f "tokens=3 delims=/" %%a in ("${{ github.ref }}") do echo ::set-output name=dist::dist-%%a
|
||||
winbuild\\build\\build_pillow.cmd --disable-imagequant bdist_wheel
|
||||
shell: cmd
|
||||
|
||||
- uses: actions/upload-artifact@v2
|
||||
if: "github.event_name == 'push'"
|
||||
# Skip wheels on 3.10 due to https://github.com/pypa/wheel/issues/354
|
||||
if: "github.event_name == 'push' && !contains(matrix.python-version, '3.10')"
|
||||
with:
|
||||
name: ${{ steps.wheel.outputs.dist }}
|
||||
path: dist\*.whl
|
||||
|
|
19
.github/workflows/test.yml
vendored
19
.github/workflows/test.yml
vendored
|
@ -14,6 +14,7 @@ jobs:
|
|||
]
|
||||
python-version: [
|
||||
"pypy3",
|
||||
"3.10-dev",
|
||||
"3.9",
|
||||
"3.8",
|
||||
"3.7",
|
||||
|
@ -21,9 +22,9 @@ jobs:
|
|||
]
|
||||
include:
|
||||
- python-version: "3.6"
|
||||
env: PYTHONOPTIMIZE=1
|
||||
PYTHONOPTIMIZE: 1
|
||||
- python-version: "3.7"
|
||||
env: PYTHONOPTIMIZE=2
|
||||
PYTHONOPTIMIZE: 2
|
||||
# Include new variables for Codecov
|
||||
- os: ubuntu-latest
|
||||
codecov-flag: GHA_Ubuntu
|
||||
|
@ -44,7 +45,7 @@ jobs:
|
|||
- name: Get pip cache dir
|
||||
id: pip-cache
|
||||
run: |
|
||||
echo "::set-output name=dir::$(pip cache dir)"
|
||||
echo "::set-output name=dir::$(python3 -m pip cache dir)"
|
||||
|
||||
- name: pip cache
|
||||
uses: actions/cache@v2
|
||||
|
@ -78,7 +79,13 @@ jobs:
|
|||
|
||||
- name: Test
|
||||
run: |
|
||||
.ci/test.sh
|
||||
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
|
||||
xvfb-run -s '-screen 0 1024x768x24' .ci/test.sh
|
||||
else
|
||||
.ci/test.sh
|
||||
fi
|
||||
env:
|
||||
PYTHONOPTIMIZE: ${{ matrix.PYTHONOPTIMIZE }}
|
||||
|
||||
- name: Prepare to upload errors
|
||||
if: failure()
|
||||
|
@ -94,9 +101,9 @@ jobs:
|
|||
path: Tests/errors
|
||||
|
||||
- name: Docs
|
||||
if: startsWith(matrix.os, 'ubuntu') && matrix.python-version == 3.8
|
||||
if: startsWith(matrix.os, 'ubuntu') && matrix.python-version == 3.9
|
||||
run: |
|
||||
pip install sphinx-removed-in sphinx-rtd-theme
|
||||
python3 -m pip install sphinx-removed-in sphinx-rtd-theme
|
||||
make doccheck
|
||||
|
||||
- name: After success
|
||||
|
|
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -81,6 +81,10 @@ docs/_build/
|
|||
|
||||
# Extra test images installed from pillow-depends/test_images
|
||||
Tests/images/README.md
|
||||
Tests/images/crash_1.tif
|
||||
Tests/images/crash_2.tif
|
||||
Tests/images/string_dimension.tiff
|
||||
Tests/images/jpeg2000
|
||||
Tests/images/msp
|
||||
Tests/images/picins
|
||||
Tests/images/sunraster
|
||||
|
|
49
.travis.yml
49
.travis.yml
|
@ -1,24 +1,13 @@
|
|||
dist: xenial
|
||||
language: python
|
||||
cache:
|
||||
pip: true
|
||||
directories:
|
||||
- $HOME/.cache/pre-commit
|
||||
cache: pip
|
||||
|
||||
notifications:
|
||||
irc: "chat.freenode.net#pil"
|
||||
|
||||
# Run fast lint first to get fast feedback.
|
||||
# Run slower CPUs next, to give them a headstart and reduce waiting time.
|
||||
# Then run the remainder.
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
- python: "3.6"
|
||||
name: "Lint"
|
||||
env: LINT="true"
|
||||
|
||||
- python: "3.6"
|
||||
arch: arm64
|
||||
- python: "3.7"
|
||||
|
@ -26,45 +15,15 @@ matrix:
|
|||
- python: "3.8"
|
||||
arch: s390x
|
||||
|
||||
- python: "pypy3.6-7.3.1"
|
||||
name: "PyPy3 Xenial"
|
||||
- python: "3.9-dev"
|
||||
name: "3.9-dev Xenial"
|
||||
services: xvfb
|
||||
- python: "3.8"
|
||||
name: "3.8 Xenial"
|
||||
services: xvfb
|
||||
- python: '3.7'
|
||||
name: "3.7 Xenial PYTHONOPTIMIZE=2"
|
||||
env: PYTHONOPTIMIZE=2
|
||||
services: xvfb
|
||||
- python: '3.6'
|
||||
name: "3.6 Xenial PYTHONOPTIMIZE=1"
|
||||
env: PYTHONOPTIMIZE=1
|
||||
services: xvfb
|
||||
|
||||
allow_failures:
|
||||
- python: "3.9-dev"
|
||||
|
||||
install:
|
||||
- |
|
||||
if [ "$LINT" == "true" ]; then
|
||||
pip install tox
|
||||
else
|
||||
.ci/install.sh;
|
||||
fi
|
||||
.ci/install.sh;
|
||||
|
||||
script:
|
||||
- |
|
||||
if [ "$LINT" == "true" ]; then
|
||||
tox -e lint
|
||||
else
|
||||
- |
|
||||
.ci/build.sh
|
||||
.ci/test.sh
|
||||
fi
|
||||
|
||||
after_success:
|
||||
- |
|
||||
if [ "$LINT" == "" ]; then
|
||||
- |
|
||||
.ci/after_success.sh
|
||||
fi
|
||||
|
|
15
CHANGES.rst
15
CHANGES.rst
|
@ -2,6 +2,21 @@
|
|||
Changelog (Pillow)
|
||||
==================
|
||||
|
||||
8.1.0 (unreleased)
|
||||
------------------
|
||||
|
||||
- Support raw rgba8888 for DDS #4760
|
||||
[qiankanglai]
|
||||
|
||||
8.0.1 (2020-10-22)
|
||||
------------------
|
||||
|
||||
- Update FreeType used in binary wheels to 2.10.4 to fix CVE-2020-15999.
|
||||
[radarhere]
|
||||
|
||||
- Moved string_dimension image to pillow-depends #4993
|
||||
[radarhere]
|
||||
|
||||
8.0.0 (2020-10-15)
|
||||
------------------
|
||||
|
||||
|
|
2
LICENSE
2
LICENSE
|
@ -7,7 +7,7 @@ Pillow is the friendly PIL fork. It is
|
|||
|
||||
Copyright © 2010-2020 by Alex Clark and contributors
|
||||
|
||||
Like PIL, Pillow is licensed under the open source PIL Software License:
|
||||
Like PIL, Pillow is licensed under the open source HPND License:
|
||||
|
||||
By obtaining, using, and/or copying this software and/or its associated
|
||||
documentation, you agree that you have read, understood, and will comply
|
||||
|
|
2
Makefile
2
Makefile
|
@ -91,6 +91,8 @@ release-test:
|
|||
python3 selftest.py
|
||||
python3 -m pytest Tests
|
||||
python3 setup.py install
|
||||
-rm dist/*.egg
|
||||
-rmdir dist
|
||||
python3 -m pytest -qq
|
||||
check-manifest
|
||||
pyroma .
|
||||
|
|
|
@ -24,12 +24,12 @@ As of 2019, Pillow development is
|
|||
<tr>
|
||||
<th>tests</th>
|
||||
<td>
|
||||
<a href="https://travis-ci.org/python-pillow/Pillow"><img
|
||||
<a href="https://travis-ci.com/github/python-pillow/Pillow"><img
|
||||
alt="Travis CI build status (Linux)"
|
||||
src="https://img.shields.io/travis/python-pillow/Pillow/master.svg?label=Linux%20build"></a>
|
||||
<a href="https://travis-ci.org/python-pillow/pillow-wheels"><img
|
||||
src="https://img.shields.io/travis/com/python-pillow/Pillow/master.svg?label=Linux%20build"></a>
|
||||
<a href="https://travis-ci.com/github/python-pillow/pillow-wheels"><img
|
||||
alt="Travis CI build status (macOS)"
|
||||
src="https://img.shields.io/travis/python-pillow/pillow-wheels/master.svg?label=macOS%20build"></a>
|
||||
src="https://img.shields.io/travis/com/python-pillow/pillow-wheels/master.svg?label=macOS%20build"></a>
|
||||
<a href="https://ci.appveyor.com/project/python-pillow/Pillow"><img
|
||||
alt="AppVeyor CI build status (Windows)"
|
||||
src="https://img.shields.io/appveyor/build/python-pillow/Pillow/master.svg?label=Windows%20build"></a>
|
||||
|
|
18
RELEASING.md
18
RELEASING.md
|
@ -6,10 +6,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 `master` branch.
|
||||
* [ ] Check [GitHub Actions](https://github.com/python-pillow/Pillow/actions),
|
||||
[Travis CI](https://travis-ci.org/github/python-pillow/Pillow) and
|
||||
[AppVeyor](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm
|
||||
passing tests in `master` branch.
|
||||
* [ ] Check [GitHub Actions](https://github.com/python-pillow/Pillow/actions), [Travis CI](https://travis-ci.com/github/python-pillow/Pillow) and [AppVeyor](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm passing tests in `master` branch.
|
||||
* [ ] Check that all of the wheel builds [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels) pass the tests in Travis CI.
|
||||
* [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), update version identifier in `src/PIL/_version.py`
|
||||
* [ ] Update `CHANGES.rst`.
|
||||
|
@ -32,7 +29,7 @@ Released quarterly on January 2nd, April 1st, July 1st and October 15th.
|
|||
twine check dist/*
|
||||
twine upload dist/Pillow-5.2.0*
|
||||
```
|
||||
* [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new)
|
||||
* [ ] Publish the [release on GitHub](https://github.com/python-pillow/Pillow/releases)
|
||||
* [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), increment and append `.dev0` to version identifier in `src/PIL/_version.py`
|
||||
|
||||
## Point Release
|
||||
|
@ -45,14 +42,11 @@ Released as needed for security, installation or critical bug fixes.
|
|||
```bash
|
||||
git checkout -t remotes/origin/5.2.x
|
||||
```
|
||||
* [ ] Cherry pick individual commits from `master` branch to release branch e.g. `5.2.x`.
|
||||
* [ ] Cherry pick individual commits from `master` branch to release branch e.g. `5.2.x`, then `git push`.
|
||||
|
||||
|
||||
|
||||
* [ ] Check [GitHub Actions](https://github.com/python-pillow/Pillow/actions),
|
||||
[Travis CI](https://travis-ci.org/github/python-pillow/Pillow) and
|
||||
[AppVeyor](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm
|
||||
passing tests in release branch e.g. `5.2.x`.
|
||||
* [ ] Check [GitHub Actions](https://github.com/python-pillow/Pillow/actions), [Travis CI](https://travis-ci.com/github/python-pillow/Pillow) and [AppVeyor](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm passing tests in release branch e.g. `5.2.x`.
|
||||
* [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), update version identifier in `src/PIL/_version.py`
|
||||
* [ ] Run pre-release check via `make release-test`.
|
||||
* [ ] Create tag for release e.g.:
|
||||
|
@ -72,7 +66,7 @@ Released as needed for security, installation or critical bug fixes.
|
|||
twine check dist/*
|
||||
twine upload dist/Pillow-5.2.0*
|
||||
```
|
||||
* [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new)
|
||||
* [ ] Publish the [release on GitHub](https://github.com/python-pillow/Pillow/releases)
|
||||
|
||||
## Embargoed Release
|
||||
|
||||
|
@ -97,7 +91,7 @@ Released as needed privately to individual vendors for critical security-related
|
|||
twine check dist/*
|
||||
```
|
||||
* [ ] Create [binary distributions](https://github.com/python-pillow/Pillow/blob/master/RELEASING.md#binary-distributions)
|
||||
* [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new)
|
||||
* [ ] Publish the [release on GitHub](https://github.com/python-pillow/Pillow/releases)
|
||||
|
||||
## Binary Distributions
|
||||
|
||||
|
|
|
@ -11,6 +11,8 @@ BungeeColor-Regular_colr_Windows.ttf, from https://github.com/djrrb/bungee
|
|||
|
||||
All of the above fonts are published under the SIL Open Font License (OFL) v1.1 (http://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=OFL), which allows you to copy, modify, and redistribute them if you need to.
|
||||
|
||||
FreeMono.ttf is licensed under GPLv3, with the GPL font exception.
|
||||
|
||||
OpenSansCondensed-LightItalic.tt, from https://fonts.google.com/specimen/Open+Sans, under Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
DejaVuSans-24-{1,2,4,8}-stripped.ttf are based on DejaVuSans.ttf converted using FontForge to add bitmap strikes and keep only the ASCII range.
|
||||
|
|
BIN
Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.dds
Normal file
BIN
Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.dds
Normal file
Binary file not shown.
BIN
Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.png
Normal file
BIN
Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 106 B |
BIN
Tests/images/argb-32bpp_MipMaps-1.dds
Normal file
BIN
Tests/images/argb-32bpp_MipMaps-1.dds
Normal file
Binary file not shown.
BIN
Tests/images/argb-32bpp_MipMaps-1.png
Normal file
BIN
Tests/images/argb-32bpp_MipMaps-1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 122 KiB |
Binary file not shown.
|
@ -12,6 +12,8 @@ TEST_FILE_DXT3 = "Tests/images/dxt3-argb-8bbp-explicitalpha_MipMaps-1.dds"
|
|||
TEST_FILE_DXT5 = "Tests/images/dxt5-argb-8bbp-interpolatedalpha_MipMaps-1.dds"
|
||||
TEST_FILE_DX10_BC7 = "Tests/images/bc7-argb-8bpp_MipMaps-1.dds"
|
||||
TEST_FILE_DX10_BC7_UNORM_SRGB = "Tests/images/DXGI_FORMAT_BC7_UNORM_SRGB.dds"
|
||||
TEST_FILE_DX10_R8G8B8A8 = "Tests/images/argb-32bpp_MipMaps-1.dds"
|
||||
TEST_FILE_DX10_R8G8B8A8_UNORM_SRGB = "Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.dds"
|
||||
TEST_FILE_UNCOMPRESSED_RGB = "Tests/images/uncompressed_rgb.dds"
|
||||
|
||||
|
||||
|
@ -88,6 +90,37 @@ def test_dx10_bc7_unorm_srgb():
|
|||
assert_image_equal(target, im)
|
||||
|
||||
|
||||
def test_dx10_r8g8b8a8():
|
||||
"""Check DX10 images can be opened"""
|
||||
|
||||
with Image.open(TEST_FILE_DX10_R8G8B8A8) as im:
|
||||
im.load()
|
||||
|
||||
assert im.format == "DDS"
|
||||
assert im.mode == "RGBA"
|
||||
assert im.size == (256, 256)
|
||||
|
||||
with Image.open(TEST_FILE_DX10_R8G8B8A8.replace(".dds", ".png")) as target:
|
||||
assert_image_equal(target, im)
|
||||
|
||||
|
||||
def test_dx10_r8g8b8a8_unorm_srgb():
|
||||
"""Check DX10 unsigned normalized integer images can be opened"""
|
||||
|
||||
with Image.open(TEST_FILE_DX10_R8G8B8A8_UNORM_SRGB) as im:
|
||||
im.load()
|
||||
|
||||
assert im.format == "DDS"
|
||||
assert im.mode == "RGBA"
|
||||
assert im.size == (16, 16)
|
||||
assert im.info["gamma"] == 1 / 2.2
|
||||
|
||||
with Image.open(
|
||||
TEST_FILE_DX10_R8G8B8A8_UNORM_SRGB.replace(".dds", ".png")
|
||||
) as target:
|
||||
assert_image_equal(target, im)
|
||||
|
||||
|
||||
def test_unimplemented_dxgi_format():
|
||||
with pytest.raises(NotImplementedError):
|
||||
Image.open("Tests/images/unimplemented_dxgi_format.dds")
|
||||
|
|
|
@ -598,6 +598,10 @@ class TestFileTiff:
|
|||
# Ignore this UserWarning which triggers for four tags:
|
||||
# "Possibly corrupt EXIF data. Expecting to read 50404352 bytes but..."
|
||||
@pytest.mark.filterwarnings("ignore:Possibly corrupt EXIF data")
|
||||
@pytest.mark.skipif(
|
||||
not os.path.exists("Tests/images/string_dimension.tiff"),
|
||||
reason="Extra image files not installed",
|
||||
)
|
||||
def test_string_dimension(self):
|
||||
# Assert that an error is raised if one of the dimensions is a string
|
||||
with pytest.raises(ValueError):
|
||||
|
|
|
@ -21,7 +21,7 @@ def test_libimagequant_quantize():
|
|||
image = hopper()
|
||||
try:
|
||||
converted = image.quantize(100, Image.LIBIMAGEQUANT)
|
||||
except ValueError as ex:
|
||||
except ValueError as ex: # pragma: no cover
|
||||
if "dependency" in str(ex).lower():
|
||||
pytest.skip("libimagequant support not available")
|
||||
else:
|
||||
|
|
|
@ -35,30 +35,8 @@ class TestImageFont:
|
|||
# Freetype has different metrics depending on the version.
|
||||
# (and, other things, but first things first)
|
||||
METRICS = {
|
||||
(">=2.3", "<2.4"): {
|
||||
"multiline": 30,
|
||||
"textsize": 12,
|
||||
"getters": (13, 16),
|
||||
"mask": (107, 13),
|
||||
"multiline-anchor": 6,
|
||||
"getlength": (36, 27, 27, 33),
|
||||
},
|
||||
(">=2.7",): {
|
||||
"multiline": 6.2,
|
||||
"textsize": 2.5,
|
||||
"getters": (12, 16),
|
||||
"mask": (108, 13),
|
||||
"multiline-anchor": 4,
|
||||
"getlength": (36, 21, 24, 33),
|
||||
},
|
||||
"Default": {
|
||||
"multiline": 0.5,
|
||||
"textsize": 0.5,
|
||||
"getters": (12, 16),
|
||||
"mask": (108, 13),
|
||||
"multiline-anchor": 4,
|
||||
"getlength": (36, 24, 24, 33),
|
||||
},
|
||||
(">=2.7",): {"multiline": 6.2, "textsize": 2.5, "getlength": (36, 21, 24, 33)},
|
||||
"Default": {"multiline": 0.5, "textsize": 0.5, "getlength": (36, 24, 24, 33)},
|
||||
}
|
||||
|
||||
@classmethod
|
||||
|
@ -395,7 +373,7 @@ class TestImageFont:
|
|||
mask = transposed_font.getmask(text)
|
||||
|
||||
# Assert
|
||||
assert mask.size == self.metrics["mask"][::-1]
|
||||
assert mask.size == (13, 108)
|
||||
|
||||
def test_unrotated_transposed_font_get_mask(self):
|
||||
# Arrange
|
||||
|
@ -408,7 +386,7 @@ class TestImageFont:
|
|||
mask = transposed_font.getmask(text)
|
||||
|
||||
# Assert
|
||||
assert mask.size == self.metrics["mask"]
|
||||
assert mask.size == (108, 13)
|
||||
|
||||
def test_free_type_font_get_name(self):
|
||||
# Arrange
|
||||
|
@ -452,7 +430,7 @@ class TestImageFont:
|
|||
mask = font.getmask(text)
|
||||
|
||||
# Assert
|
||||
assert mask.size == self.metrics["mask"]
|
||||
assert mask.size == (108, 13)
|
||||
|
||||
def test_load_path_not_found(self):
|
||||
# Arrange
|
||||
|
@ -633,7 +611,7 @@ class TestImageFont:
|
|||
assert t.font.glyphs == 4177
|
||||
assert t.getsize("A") == (12, 16)
|
||||
assert t.getsize("AB") == (24, 16)
|
||||
assert t.getsize("M") == self.metrics["getters"]
|
||||
assert t.getsize("M") == (12, 16)
|
||||
assert t.getsize("y") == (12, 20)
|
||||
assert t.getsize("a") == (12, 16)
|
||||
assert t.getsize_multiline("A") == (12, 16)
|
||||
|
@ -869,7 +847,7 @@ class TestImageFont:
|
|||
)
|
||||
|
||||
with Image.open(target) as expected:
|
||||
assert_image_similar(im, expected, self.metrics["multiline-anchor"])
|
||||
assert_image_similar(im, expected, 4)
|
||||
|
||||
def test_anchor_invalid(self):
|
||||
font = self.get_font()
|
||||
|
|
|
@ -5,4 +5,4 @@ git fetch origin master:refs/remotes/origin/master
|
|||
|
||||
# CFLAGS=-O0 means build with no optimisation.
|
||||
# Makes build much quicker for lxml and other dependencies.
|
||||
time CFLAGS=-O0 pip install diff_cover
|
||||
time CFLAGS=-O0 python3 -m pip install diff_cover
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/bash
|
||||
# install libimagequant
|
||||
|
||||
archive=libimagequant-2.12.6
|
||||
archive=libimagequant-2.13.1
|
||||
|
||||
./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/master/$archive.tar.gz
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# install raqm
|
||||
|
||||
|
||||
archive=raqm-0.7.0
|
||||
archive=raqm-0.7.1
|
||||
|
||||
./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/master/$archive.tar.gz
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ The fork author's goal is to foster and support active development of PIL throug
|
|||
- Publicized development activity on `GitHub`_
|
||||
- Regular releases to the `Python Package Index`_
|
||||
|
||||
.. _Travis CI: https://travis-ci.org/python-pillow/Pillow
|
||||
.. _Travis CI: https://travis-ci.com/github/python-pillow/Pillow
|
||||
.. _AppVeyor: https://ci.appveyor.com/project/Python-pillow/pillow
|
||||
.. _GitHub Actions: https://github.com/python-pillow/Pillow/actions
|
||||
.. _GitHub: https://github.com/python-pillow/Pillow
|
||||
|
@ -19,7 +19,7 @@ The fork author's goal is to foster and support active development of PIL throug
|
|||
License
|
||||
-------
|
||||
|
||||
Like PIL, Pillow is `licensed under the open source PIL Software License <https://raw.githubusercontent.com/python-pillow/Pillow/master/LICENSE>`_
|
||||
Like PIL, Pillow is `licensed under the open source HPND License <https://raw.githubusercontent.com/python-pillow/Pillow/master/LICENSE>`_
|
||||
|
||||
Why a fork?
|
||||
-----------
|
||||
|
|
|
@ -143,7 +143,7 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
|||
|
||||
# The name of an image file (relative to this directory) to place at the top
|
||||
# of the sidebar.
|
||||
# html_logo = None
|
||||
html_logo = "resources/pillow-logo.png"
|
||||
|
||||
# The name of an image file (within the static path) to use as favicon of the
|
||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||
|
|
|
@ -125,7 +125,7 @@ following options are available::
|
|||
**append_images**
|
||||
A list of images to append as additional frames. Each of the
|
||||
images in the list can be single or multiframe images.
|
||||
This is currently supported for GIF, PDF, TIFF, and WebP.
|
||||
This is currently supported for GIF, PDF, PNG, TIFF, and WebP.
|
||||
|
||||
It is also supported for ICNS. If images are passed in of relevant sizes,
|
||||
they will be used instead of scaling down the main image.
|
||||
|
@ -561,8 +561,8 @@ The :py:meth:`~PIL.Image.Image.save` method supports the following options:
|
|||
.. note::
|
||||
|
||||
To enable PNG support, you need to build and install the ZLIB compression
|
||||
library before building the Python Imaging Library. See the `installation
|
||||
documentation <../installation.html>`_ for details.
|
||||
library before building the Python Imaging Library. See the
|
||||
:doc:`installation documentation <../installation>` for details.
|
||||
|
||||
.. _apng-sequences:
|
||||
|
||||
|
@ -947,9 +947,10 @@ Saving sequences
|
|||
library is v0.5.0 or later. You can check webp animation support at
|
||||
runtime by calling ``features.check("webp_anim")``.
|
||||
|
||||
When calling :py:meth:`~PIL.Image.Image.save` to write a WebP file, the
|
||||
following options are available when the ``save_all`` argument is present and
|
||||
true.
|
||||
When calling :py:meth:`~PIL.Image.Image.save` to write a WebP file, by default
|
||||
only the first frame of a multiframe image will be saved. If the ``save_all``
|
||||
argument is present and true, then all frames will be saved, and the following
|
||||
options will also be available.
|
||||
|
||||
**append_images**
|
||||
A list of images to append as additional frames. Each of the
|
||||
|
|
|
@ -157,7 +157,7 @@ The raw decoder
|
|||
The ``raw`` decoder is used to read uncompressed data from an image file. It
|
||||
can be used with most uncompressed file formats, such as PPM, BMP, uncompressed
|
||||
TIFF, and many others. To use the raw decoder with the
|
||||
:py:func:`PIL.Image.frombytes` function, use the following syntax::
|
||||
:py:func:`PIL.Image.frombytes` function, use the following syntax:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@ Pillow for enterprise is available via the Tidelift Subscription. `Learn more <h
|
|||
:target: https://pillow.readthedocs.io/?badge=latest
|
||||
:alt: Documentation Status
|
||||
|
||||
.. image:: https://img.shields.io/travis/python-pillow/Pillow/master.svg?label=Linux%20build
|
||||
:target: https://travis-ci.org/python-pillow/Pillow
|
||||
.. image:: https://img.shields.io/travis/com/python-pillow/Pillow/master.svg?label=Linux%20build
|
||||
:target: https://travis-ci.com/github/python-pillow/Pillow
|
||||
:alt: Travis CI build status (Linux)
|
||||
|
||||
.. image:: https://img.shields.io/travis/python-pillow/pillow-wheels/master.svg?label=macOS%20build
|
||||
:target: https://travis-ci.org/python-pillow/pillow-wheels
|
||||
.. image:: https://img.shields.io/travis/com/python-pillow/pillow-wheels/master.svg?label=macOS%20build
|
||||
:target: https://travis-ci.com/github/python-pillow/pillow-wheels
|
||||
:alt: Travis CI build status (macOS)
|
||||
|
||||
.. image:: https://img.shields.io/appveyor/build/python-pillow/Pillow/master.svg?label=Windows%20build
|
||||
|
|
|
@ -177,7 +177,7 @@ Many of Pillow's features require external libraries:
|
|||
|
||||
* **libimagequant** provides improved color quantization
|
||||
|
||||
* Pillow has been tested with libimagequant **2.6-2.12.6**
|
||||
* Pillow has been tested with libimagequant **2.6-2.13.1**
|
||||
* Libimagequant is licensed GPLv3, which is more restrictive than
|
||||
the Pillow license, therefore we will not be distributing binaries
|
||||
with libimagequant support enabled.
|
||||
|
@ -422,33 +422,27 @@ These platforms are built and tested for every change.
|
|||
+----------------------------------+--------------------------+-----------------------+
|
||||
| Arch | 3.8 |x86-64 |
|
||||
+----------------------------------+--------------------------+-----------------------+
|
||||
| Amazon Linux 1 | 3.6 |x86-64 |
|
||||
+----------------------------------+--------------------------+-----------------------+
|
||||
| Amazon Linux 2 | 3.7 |x86-64 |
|
||||
+----------------------------------+--------------------------+-----------------------+
|
||||
| CentOS 6 | 3.6 |x86-64 |
|
||||
+----------------------------------+--------------------------+-----------------------+
|
||||
| CentOS 7 | 3.6 |x86-64 |
|
||||
+----------------------------------+--------------------------+-----------------------+
|
||||
| CentOS 8 | 3.6 |x86-64 |
|
||||
+----------------------------------+--------------------------+-----------------------+
|
||||
| Debian 10 Buster | 3.7 |x86 |
|
||||
+----------------------------------+--------------------------+-----------------------+
|
||||
| Fedora 31 | 3.7 |x86-64 |
|
||||
+----------------------------------+--------------------------+-----------------------+
|
||||
| Fedora 32 | 3.8 |x86-64 |
|
||||
+----------------------------------+--------------------------+-----------------------+
|
||||
| Fedora 33 | 3.9 |x86-64 |
|
||||
+----------------------------------+--------------------------+-----------------------+
|
||||
| macOS 10.15 Catalina | 3.6, 3.7, 3.8, 3.9, PyPy3|x86-64 |
|
||||
+----------------------------------+--------------------------+-----------------------+
|
||||
| Ubuntu Linux 16.04 LTS (Xenial) | 3.6, 3.7, 3.8, PyPy3 |x86-64 |
|
||||
| Ubuntu Linux 16.04 LTS (Xenial) | 3.6, 3.7, 3.8, 3.9, PyPy3|x86-64 |
|
||||
+----------------------------------+--------------------------+-----------------------+
|
||||
| Ubuntu Linux 18.04 LTS (Bionic) | 3.6, 3.7, 3.8, 3.9, PyPy3|x86-64 |
|
||||
+----------------------------------+--------------------------+-----------------------+
|
||||
| Ubuntu Linux 20.04 LTS (Focal) | 3.8 |x86-64 |
|
||||
+----------------------------------+--------------------------+-----------------------+
|
||||
| Windows Server 2016 | 3.8 |x86 |
|
||||
| +--------------------------+-----------------------+
|
||||
| | 3.6 |x86-64 |
|
||||
| Windows Server 2016 | 3.6 |x86-64 |
|
||||
+----------------------------------+--------------------------+-----------------------+
|
||||
| Windows Server 2019 | 3.6, 3.7, 3.8, 3.9 |x86, x86-64 |
|
||||
| +--------------------------+-----------------------+
|
||||
|
@ -471,7 +465,11 @@ These platforms have been reported to work at the versions mentioned.
|
|||
+----------------------------------+------------------------------+--------------------------------+-----------------------+
|
||||
|**Operating system** |**Tested Python versions** |**Latest tested Pillow version**|**Tested processors** |
|
||||
+----------------------------------+------------------------------+--------------------------------+-----------------------+
|
||||
| macOS 10.15 Catalina | 3.5, 3.6, 3.7, 3.8 | 7.2.0 |x86-64 |
|
||||
| macOS 11.0 Big Sur | 3.6, 3.7, 3.8, 3.9 | 8.0.1 |x86-64 |
|
||||
+----------------------------------+------------------------------+--------------------------------+-----------------------+
|
||||
| macOS 10.15 Catalina | 3.6, 3.7, 3.8, 3.9 | 8.0.1 |x86-64 |
|
||||
| +------------------------------+--------------------------------+ +
|
||||
| | 3.5 | 7.2.0 | |
|
||||
+----------------------------------+------------------------------+--------------------------------+-----------------------+
|
||||
| macOS 10.14 Mojave | 3.5, 3.6, 3.7, 3.8 | 7.2.0 |x86-64 |
|
||||
| +------------------------------+--------------------------------+ +
|
||||
|
|
|
@ -296,7 +296,7 @@ Methods
|
|||
Draws the string at the given position.
|
||||
|
||||
:param xy: The anchor coordinates of the text.
|
||||
:param text: Text to be drawn. If it contains any newline characters,
|
||||
:param text: String to be drawn. If it contains any newline characters,
|
||||
the text is passed on to
|
||||
:py:meth:`~PIL.ImageDraw.ImageDraw.multiline_text`.
|
||||
:param fill: Color to use for the text.
|
||||
|
@ -362,7 +362,7 @@ Methods
|
|||
Draws the string at the given position.
|
||||
|
||||
:param xy: The anchor coordinates of the text.
|
||||
:param text: Text to be drawn.
|
||||
:param text: String to be drawn.
|
||||
:param fill: Color to use for the text.
|
||||
:param font: An :py:class:`~PIL.ImageFont.ImageFont` instance.
|
||||
|
||||
|
|
|
@ -8,10 +8,10 @@ The :py:mod:`~PIL.ImageFont` module defines a class with the same name. Instance
|
|||
this class store bitmap fonts, and are used with the
|
||||
:py:meth:`PIL.ImageDraw.ImageDraw.text` method.
|
||||
|
||||
PIL uses its own font file format to store bitmap fonts. You can use the
|
||||
:command:`pilfont` utility from
|
||||
`pillow-scripts <https://pypi.org/project/pillow-scripts/>`_
|
||||
to convert BDF and PCF font descriptors (X window font formats) to this format.
|
||||
PIL uses its own font file format to store bitmap fonts. You can use
|
||||
`pilfont.py <https://github.com/python-pillow/pillow-scripts/blob/master/Scripts/pilfont.py>`_
|
||||
from `pillow-scripts <https://pypi.org/project/pillow-scripts/>`_ to convert BDF and
|
||||
PCF font descriptors (X window font formats) to this format.
|
||||
|
||||
Starting with version 1.1.4, PIL can be configured to support TrueType and
|
||||
OpenType fonts (as well as other font formats supported by the FreeType
|
||||
|
|
|
@ -6,10 +6,9 @@ Added Complex Text Rendering
|
|||
|
||||
Pillow now supports complex text rendering for scripts requiring glyph
|
||||
composition and bidirectional flow. This optional feature adds three
|
||||
dependencies: harfbuzz, fribidi, and raqm. See the `install
|
||||
documentation <../installation.html>`_ for further details. This feature is
|
||||
tested and works on Unix and Mac, but has not yet been built on Windows
|
||||
platforms.
|
||||
dependencies: harfbuzz, fribidi, and raqm. See the :doc:`install documentation
|
||||
<../installation>` for further details. This feature is tested and works on
|
||||
Unix and Mac, but has not yet been built on Windows platforms.
|
||||
|
||||
New Optional Parameters
|
||||
=======================
|
||||
|
|
|
@ -17,7 +17,7 @@ Removed deprecated PIL.OleFileIO
|
|||
PIL.OleFileIO was removed as a vendored file and in Pillow 4.0.0 (2017-01) in favour of
|
||||
the upstream olefile Python package, and replaced with an ``ImportError``. The
|
||||
deprecated file has now been removed from Pillow. If needed, install from PyPI (eg.
|
||||
``pip install olefile``).
|
||||
``python3 -m pip install olefile``).
|
||||
|
||||
Removed deprecated ImageOps functions
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
25
docs/releasenotes/8.0.1.rst
Normal file
25
docs/releasenotes/8.0.1.rst
Normal file
|
@ -0,0 +1,25 @@
|
|||
8.0.1
|
||||
-----
|
||||
|
||||
Security
|
||||
========
|
||||
|
||||
Update FreeType used in binary wheels to `2.10.4`_ to fix CVE-2020-15999_:
|
||||
|
||||
- A heap buffer overflow has been found in the handling of embedded PNG bitmaps,
|
||||
introduced in FreeType version 2.6.
|
||||
|
||||
https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15999
|
||||
|
||||
If you use option ``FT_CONFIG_OPTION_USE_PNG`` you should upgrade immediately.
|
||||
|
||||
We strongly recommend updating to Pillow 8.0.1 if you are using Pillow 8.0.0, which improved support for bitmap fonts.
|
||||
|
||||
In Pillow 7.2.0 and earlier bitmap fonts were disabled with ``FT_LOAD_NO_BITMAP``, but it is not
|
||||
clear if this prevents the exploit and we recommend updating to Pillow 8.0.1.
|
||||
|
||||
Pillow 8.0.0 and earlier are potentially vulnerable releases, including the last release
|
||||
to support Python 2.7, namely Pillow 6.2.2.
|
||||
|
||||
.. _2.10.4: https://sourceforge.net/projects/freetype/files/freetype2/2.10.4/
|
||||
.. _CVE-2020-15999: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-15999
|
|
@ -13,6 +13,7 @@ expected to be backported to earlier versions.
|
|||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
8.0.1
|
||||
8.0.0
|
||||
7.2.0
|
||||
7.1.2
|
||||
|
|
BIN
docs/resources/pillow-logo.png
Normal file
BIN
docs/resources/pillow-logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
16
setup.py
16
setup.py
|
@ -38,12 +38,16 @@ ZLIB_ROOT = None
|
|||
|
||||
|
||||
if sys.platform == "win32" and sys.version_info >= (3, 10):
|
||||
warnings.warn(
|
||||
f"Pillow {PILLOW_VERSION} does not support Python "
|
||||
f"{sys.version_info.major}.{sys.version_info.minor} and does not provide "
|
||||
"prebuilt Windows binaries. We do not recommend building from source on "
|
||||
"Windows.",
|
||||
RuntimeWarning,
|
||||
import atexit
|
||||
|
||||
atexit.register(
|
||||
lambda: warnings.warn(
|
||||
f"Pillow {PILLOW_VERSION} does not support Python "
|
||||
f"{sys.version_info.major}.{sys.version_info.minor} and does not provide "
|
||||
"prebuilt Windows binaries. We do not recommend building from source on "
|
||||
"Windows.",
|
||||
RuntimeWarning,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -94,6 +94,9 @@ DXT5_FOURCC = 0x35545844
|
|||
|
||||
# dxgiformat.h
|
||||
|
||||
DXGI_FORMAT_R8G8B8A8_TYPELESS = 27
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM = 28
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB = 29
|
||||
DXGI_FORMAT_BC7_TYPELESS = 97
|
||||
DXGI_FORMAT_BC7_UNORM = 98
|
||||
DXGI_FORMAT_BC7_UNORM_SRGB = 99
|
||||
|
@ -157,6 +160,15 @@ class DdsImageFile(ImageFile.ImageFile):
|
|||
self.pixel_format = "BC7"
|
||||
self.info["gamma"] = 1 / 2.2
|
||||
n = 7
|
||||
elif dxgi_format in (
|
||||
DXGI_FORMAT_R8G8B8A8_TYPELESS,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
DXGI_FORMAT_R8G8B8A8_UNORM_SRGB,
|
||||
):
|
||||
self.tile = [("raw", (0, 0) + self.size, 0, ("RGBA", 0, 1))]
|
||||
if dxgi_format == DXGI_FORMAT_R8G8B8A8_UNORM_SRGB:
|
||||
self.info["gamma"] = 1 / 2.2
|
||||
return
|
||||
else:
|
||||
raise NotImplementedError(
|
||||
f"Unimplemented DXGI format {dxgi_format}"
|
||||
|
|
|
@ -2905,6 +2905,8 @@ def open(fp, mode="r", formats=None):
|
|||
|
||||
def _open_core(fp, filename, prefix, formats):
|
||||
for i in formats:
|
||||
if i not in OPEN:
|
||||
init()
|
||||
try:
|
||||
factory, accept = OPEN[i]
|
||||
result = not accept or accept(prefix)
|
||||
|
|
|
@ -285,7 +285,7 @@ class FreeTypeFont:
|
|||
the font which language the text is in, and to apply the
|
||||
correct substitutions as appropriate, if available.
|
||||
It should be a `BCP 47 language code
|
||||
<https://www.w3.org/International/articles/language-tags/>`
|
||||
<https://www.w3.org/International/articles/language-tags/>`_
|
||||
Requires libraqm.
|
||||
|
||||
:return: Width for horizontal, height for vertical text.
|
||||
|
@ -338,7 +338,7 @@ class FreeTypeFont:
|
|||
the font which language the text is in, and to apply the
|
||||
correct substitutions as appropriate, if available.
|
||||
It should be a `BCP 47 language code
|
||||
<https://www.w3.org/International/articles/language-tags/>`
|
||||
<https://www.w3.org/International/articles/language-tags/>`_
|
||||
Requires libraqm.
|
||||
|
||||
:param stroke_width: The width of the text stroke.
|
||||
|
@ -398,7 +398,7 @@ class FreeTypeFont:
|
|||
the font which language the text is in, and to apply the
|
||||
correct substitutions as appropriate, if available.
|
||||
It should be a `BCP 47 language code
|
||||
<https://www.w3.org/International/articles/language-tags/>`
|
||||
<https://www.w3.org/International/articles/language-tags/>`_
|
||||
Requires libraqm.
|
||||
|
||||
.. versionadded:: 6.0.0
|
||||
|
@ -455,7 +455,7 @@ class FreeTypeFont:
|
|||
the font which language the text is in, and to apply the
|
||||
correct substitutions as appropriate, if available.
|
||||
It should be a `BCP 47 language code
|
||||
<https://www.w3.org/International/articles/language-tags/>`
|
||||
<https://www.w3.org/International/articles/language-tags/>`_
|
||||
Requires libraqm.
|
||||
|
||||
.. versionadded:: 6.0.0
|
||||
|
@ -539,7 +539,7 @@ class FreeTypeFont:
|
|||
the font which language the text is in, and to apply the
|
||||
correct substitutions as appropriate, if available.
|
||||
It should be a `BCP 47 language code
|
||||
<https://www.w3.org/International/articles/language-tags/>`
|
||||
<https://www.w3.org/International/articles/language-tags/>`_
|
||||
Requires libraqm.
|
||||
|
||||
.. versionadded:: 6.0.0
|
||||
|
@ -625,7 +625,7 @@ class FreeTypeFont:
|
|||
the font which language the text is in, and to apply the
|
||||
correct substitutions as appropriate, if available.
|
||||
It should be a `BCP 47 language code
|
||||
<https://www.w3.org/International/articles/language-tags/>`
|
||||
<https://www.w3.org/International/articles/language-tags/>`_
|
||||
Requires libraqm.
|
||||
|
||||
.. versionadded:: 6.0.0
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
* See the README file for information on usage and redistribution.
|
||||
*/
|
||||
|
||||
|
||||
#define PY_SSIZE_T_CLEAN
|
||||
#include "Python.h"
|
||||
|
||||
#include "libImaging/Imaging.h"
|
||||
|
@ -196,7 +196,7 @@ static PyObject*
|
|||
_frombytes(ImagingDisplayObject* display, PyObject* args)
|
||||
{
|
||||
char* ptr;
|
||||
int bytes;
|
||||
Py_ssize_t bytes;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "y#:frombytes", &ptr, &bytes)) {
|
||||
return NULL;
|
||||
|
@ -234,8 +234,6 @@ static struct PyMethodDef methods[] = {
|
|||
{"releasedc", (PyCFunction)_releasedc, 1},
|
||||
{"frombytes", (PyCFunction)_frombytes, 1},
|
||||
{"tobytes", (PyCFunction)_tobytes, 1},
|
||||
{"fromstring", (PyCFunction)_frombytes, 1},
|
||||
{"tostring", (PyCFunction)_tobytes, 1},
|
||||
{NULL, NULL} /* sentinel */
|
||||
};
|
||||
|
||||
|
@ -777,7 +775,7 @@ PyImaging_DrawWmf(PyObject* self, PyObject* args)
|
|||
char* ptr;
|
||||
|
||||
char* data;
|
||||
int datasize;
|
||||
Py_ssize_t datasize;
|
||||
int width, height;
|
||||
int x0, y0, x1, y1;
|
||||
if (!PyArg_ParseTuple(args, "y#(ii)(iiii):_load", &data, &datasize,
|
||||
|
|
4
tox.ini
4
tox.ini
|
@ -1,7 +1,7 @@
|
|||
# Tox (https://tox.readthedocs.io/en/latest/) is a tool for running tests
|
||||
# in multiple virtualenvs. This configuration file will run the
|
||||
# test suite on all supported python versions. To use it, "pip install tox"
|
||||
# and then run "tox" from this directory.
|
||||
# test suite on all supported python versions. To use it,
|
||||
# "python3 -m pip install tox" and then run "tox" from this directory.
|
||||
|
||||
[tox]
|
||||
envlist =
|
||||
|
|
|
@ -82,7 +82,7 @@ Pillow for the selected version of Python.
|
|||
instead of installing Pillow.
|
||||
|
||||
You can also use ``winbuild\build\build_pillow.cmd --inplace develop`` to build
|
||||
and install Pillow in develop mode (instead of ``pip install --editable``).
|
||||
and install Pillow in develop mode (instead of ``python3 -m pip install --editable``).
|
||||
|
||||
Testing Pillow
|
||||
--------------
|
||||
|
|
|
@ -105,9 +105,9 @@ header = [
|
|||
# dependencies, listed in order of compilation
|
||||
deps = {
|
||||
"libjpeg": {
|
||||
"url": SF_MIRROR + "/project/libjpeg-turbo/2.0.5/libjpeg-turbo-2.0.5.tar.gz",
|
||||
"filename": "libjpeg-turbo-2.0.5.tar.gz",
|
||||
"dir": "libjpeg-turbo-2.0.5",
|
||||
"url": SF_MIRROR + "/project/libjpeg-turbo/2.0.6/libjpeg-turbo-2.0.6.tar.gz",
|
||||
"filename": "libjpeg-turbo-2.0.6.tar.gz",
|
||||
"dir": "libjpeg-turbo-2.0.6",
|
||||
"build": [
|
||||
cmd_cmake(
|
||||
[
|
||||
|
@ -184,9 +184,9 @@ deps = {
|
|||
"libs": [r"libpng16.lib"],
|
||||
},
|
||||
"freetype": {
|
||||
"url": "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.3.tar.gz", # noqa: E501
|
||||
"filename": "freetype-2.10.3.tar.gz",
|
||||
"dir": "freetype-2.10.3",
|
||||
"url": "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.4.tar.gz", # noqa: E501
|
||||
"filename": "freetype-2.10.4.tar.gz",
|
||||
"dir": "freetype-2.10.4",
|
||||
"patch": {
|
||||
r"builds\windows\vc2010\freetype.vcxproj": {
|
||||
# freetype setting is /MD for .dll and /MT for .lib, we need /MD
|
||||
|
@ -287,9 +287,9 @@ deps = {
|
|||
"libs": [r"*.lib"],
|
||||
},
|
||||
"fribidi": {
|
||||
"url": "https://github.com/fribidi/fribidi/archive/v1.0.9.zip",
|
||||
"filename": "fribidi-1.0.9.zip",
|
||||
"dir": "fribidi-1.0.9",
|
||||
"url": "https://github.com/fribidi/fribidi/archive/v1.0.10.zip",
|
||||
"filename": "fribidi-1.0.10.zip",
|
||||
"dir": "fribidi-1.0.10",
|
||||
"build": [
|
||||
cmd_copy(r"{winbuild_dir}\fribidi.cmake", r"CMakeLists.txt"),
|
||||
cmd_cmake(),
|
||||
|
@ -300,9 +300,9 @@ deps = {
|
|||
"libs": [r"*.lib"],
|
||||
},
|
||||
"libraqm": {
|
||||
"url": "https://github.com/HOST-Oman/libraqm/archive/v0.7.0.zip",
|
||||
"filename": "libraqm-0.7.0.zip",
|
||||
"dir": "libraqm-0.7.0",
|
||||
"url": "https://github.com/HOST-Oman/libraqm/archive/v0.7.1.zip",
|
||||
"filename": "libraqm-0.7.1.zip",
|
||||
"dir": "libraqm-0.7.1",
|
||||
"build": [
|
||||
cmd_copy(r"{winbuild_dir}\raqm.cmake", r"CMakeLists.txt"),
|
||||
cmd_cmake(),
|
||||
|
|
|
@ -99,4 +99,4 @@ add_library(fribidi STATIC
|
|||
${FRIBIDI_SOURCES_GENERATED})
|
||||
fribidi_definitions(fribidi)
|
||||
target_compile_definitions(fribidi
|
||||
PUBLIC -DFRIBIDI_ENTRY=extern)
|
||||
PUBLIC -DFRIBIDI_LIB_STATIC)
|
||||
|
|
|
@ -7,7 +7,7 @@ find_library(fribidi NAMES fribidi)
|
|||
find_library(harfbuzz NAMES harfbuzz)
|
||||
find_library(freetype NAMES freetype)
|
||||
|
||||
add_definitions(-DFRIBIDI_ENTRY=extern)
|
||||
add_definitions(-DFRIBIDI_LIB_STATIC)
|
||||
|
||||
|
||||
function(raqm_conf)
|
||||
|
|
Loading…
Reference in New Issue
Block a user