diff --git a/.appveyor.yml b/.appveyor.yml index 8ef91212d..a77033ec1 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -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 diff --git a/.ci/after_success.sh b/.ci/after_success.sh index dcf276daa..762670f10 100755 --- a/.ci/after_success.sh +++ b/.ci/after_success.sh @@ -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 diff --git a/.ci/install.sh b/.ci/install.sh index afb88eb17..db259bdca 100755 --- a/.ci/install.sh +++ b/.ci/install.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 diff --git a/.ci/test.sh b/.ci/test.sh index 579372a62..1396445e0 100755 --- a/.ci/test.sh +++ b/.ci/test.sh @@ -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 diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 3d27b5d88..a65487d5e 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -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 diff --git a/.github/mergify.yml b/.github/mergify.yml index 3683bc483..fd4b5271f 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -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 diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 000000000..0412bd9dd --- /dev/null +++ b/.github/release-drafter.yml @@ -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 diff --git a/.github/workflows/macos-install.sh b/.github/workflows/macos-install.sh index 16f532edf..afcb9a5a7 100755 --- a/.github/workflows/macos-install.sh +++ b/.github/workflows/macos-install.sh @@ -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 diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml new file mode 100644 index 000000000..52456597b --- /dev/null +++ b/.github/workflows/release-drafter.yml @@ -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 }} diff --git a/.github/workflows/test-docker.yml b/.github/workflows/test-docker.yml index 322244b12..f6814f932 100644 --- a/.github/workflows/test-docker.yml +++ b/.github/workflows/test-docker.yml @@ -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] diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index d384a7d29..91d41fdb0 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -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 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6cb099640..51ce9d085 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -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 diff --git a/.gitignore b/.gitignore index ef7520c0d..15add232b 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/.travis.yml b/.travis.yml index b02f054d0..e239ed496 100644 --- a/.travis.yml +++ b/.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 diff --git a/CHANGES.rst b/CHANGES.rst index 57b500aa3..e7090219f 100644 --- a/CHANGES.rst +++ b/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) ------------------ diff --git a/LICENSE b/LICENSE index 4aac532f4..eb9c41f56 100644 --- a/LICENSE +++ b/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 diff --git a/Makefile b/Makefile index 519dadb30..e0bde5a0b 100644 --- a/Makefile +++ b/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 . diff --git a/README.md b/README.md index 0e6fa1157..9ead486a0 100644 --- a/README.md +++ b/README.md @@ -24,12 +24,12 @@ As of 2019, Pillow development is tests - Travis CI build status (Linux) - + Travis CI build status (macOS) + src="https://img.shields.io/travis/com/python-pillow/pillow-wheels/master.svg?label=macOS%20build"> AppVeyor CI build status (Windows) diff --git a/RELEASING.md b/RELEASING.md index 514c61519..ea6642ef4 100644 --- a/RELEASING.md +++ b/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 diff --git a/Tests/fonts/LICENSE.txt b/Tests/fonts/LICENSE.txt index db3af7c34..06eaa9a4e 100644 --- a/Tests/fonts/LICENSE.txt +++ b/Tests/fonts/LICENSE.txt @@ -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. diff --git a/Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.dds b/Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.dds new file mode 100644 index 000000000..1da9293de Binary files /dev/null and b/Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.dds differ diff --git a/Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.png b/Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.png new file mode 100644 index 000000000..57177fe2b Binary files /dev/null and b/Tests/images/DXGI_FORMAT_R8G8B8A8_UNORM_SRGB.png differ diff --git a/Tests/images/argb-32bpp_MipMaps-1.dds b/Tests/images/argb-32bpp_MipMaps-1.dds new file mode 100644 index 000000000..d1d1998b1 Binary files /dev/null and b/Tests/images/argb-32bpp_MipMaps-1.dds differ diff --git a/Tests/images/argb-32bpp_MipMaps-1.png b/Tests/images/argb-32bpp_MipMaps-1.png new file mode 100644 index 000000000..3570ccf35 Binary files /dev/null and b/Tests/images/argb-32bpp_MipMaps-1.png differ diff --git a/Tests/images/string_dimension.tiff b/Tests/images/string_dimension.tiff deleted file mode 100644 index d0b558301..000000000 Binary files a/Tests/images/string_dimension.tiff and /dev/null differ diff --git a/Tests/test_file_dds.py b/Tests/test_file_dds.py index 0aec9ea37..1cd7a1be7 100644 --- a/Tests/test_file_dds.py +++ b/Tests/test_file_dds.py @@ -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") diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index bcffecd35..f644ef887 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -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): diff --git a/Tests/test_image_quantize.py b/Tests/test_image_quantize.py index 192617a52..921c39e3f 100644 --- a/Tests/test_image_quantize.py +++ b/Tests/test_image_quantize.py @@ -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: diff --git a/Tests/test_imagefont.py b/Tests/test_imagefont.py index 7824b7f53..06ed42658 100644 --- a/Tests/test_imagefont.py +++ b/Tests/test_imagefont.py @@ -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() diff --git a/depends/diffcover-install.sh b/depends/diffcover-install.sh index a0b462b56..18be4f9f9 100755 --- a/depends/diffcover-install.sh +++ b/depends/diffcover-install.sh @@ -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 diff --git a/depends/install_imagequant.sh b/depends/install_imagequant.sh index 1f2b677fd..ed438f904 100755 --- a/depends/install_imagequant.sh +++ b/depends/install_imagequant.sh @@ -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 diff --git a/depends/install_raqm.sh b/depends/install_raqm.sh index 38a5bfd52..a7ce16792 100755 --- a/depends/install_raqm.sh +++ b/depends/install_raqm.sh @@ -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 diff --git a/docs/about.rst b/docs/about.rst index 283135aca..acd361fa8 100644 --- a/docs/about.rst +++ b/docs/about.rst @@ -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 `_ +Like PIL, Pillow is `licensed under the open source HPND License `_ Why a fork? ----------- diff --git a/docs/conf.py b/docs/conf.py index b5f8ad59d..a8f101141 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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 diff --git a/docs/handbook/image-file-formats.rst b/docs/handbook/image-file-formats.rst index 5ed72ac1a..e15a02aed 100644 --- a/docs/handbook/image-file-formats.rst +++ b/docs/handbook/image-file-formats.rst @@ -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 diff --git a/docs/handbook/writing-your-own-file-decoder.rst b/docs/handbook/writing-your-own-file-decoder.rst index 97cb5abe1..03b4ca601 100644 --- a/docs/handbook/writing-your-own-file-decoder.rst +++ b/docs/handbook/writing-your-own-file-decoder.rst @@ -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 diff --git a/docs/index.rst b/docs/index.rst index fb59a6c00..eafcb1fec 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -9,12 +9,12 @@ Pillow for enterprise is available via the Tidelift Subscription. `Learn more `_ -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 `_ +from `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 diff --git a/docs/releasenotes/4.2.0.rst b/docs/releasenotes/4.2.0.rst index a3e29f271..1e9637f1e 100644 --- a/docs/releasenotes/4.2.0.rst +++ b/docs/releasenotes/4.2.0.rst @@ -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 ======================= diff --git a/docs/releasenotes/6.0.0.rst b/docs/releasenotes/6.0.0.rst index 0145347f2..3e3b945a0 100644 --- a/docs/releasenotes/6.0.0.rst +++ b/docs/releasenotes/6.0.0.rst @@ -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 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/docs/releasenotes/8.0.1.rst b/docs/releasenotes/8.0.1.rst new file mode 100644 index 000000000..e50596e5c --- /dev/null +++ b/docs/releasenotes/8.0.1.rst @@ -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 diff --git a/docs/releasenotes/index.rst b/docs/releasenotes/index.rst index ba81fbaf8..5c74bed9b 100644 --- a/docs/releasenotes/index.rst +++ b/docs/releasenotes/index.rst @@ -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 diff --git a/docs/resources/pillow-logo.png b/docs/resources/pillow-logo.png new file mode 100644 index 000000000..1cc2006a6 Binary files /dev/null and b/docs/resources/pillow-logo.png differ diff --git a/setup.py b/setup.py index 15a6ec282..5bc683c8c 100755 --- a/setup.py +++ b/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, + ) ) diff --git a/src/PIL/DdsImagePlugin.py b/src/PIL/DdsImagePlugin.py index 3837192ab..df2d0060c 100644 --- a/src/PIL/DdsImagePlugin.py +++ b/src/PIL/DdsImagePlugin.py @@ -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}" diff --git a/src/PIL/Image.py b/src/PIL/Image.py index f9a5d82fd..8d3f6b0aa 100644 --- a/src/PIL/Image.py +++ b/src/PIL/Image.py @@ -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) diff --git a/src/PIL/ImageFont.py b/src/PIL/ImageFont.py index 89d180ce8..3a8a309c6 100644 --- a/src/PIL/ImageFont.py +++ b/src/PIL/ImageFont.py @@ -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 - ` + `_ 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 - ` + `_ 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 - ` + `_ 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 - ` + `_ 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 - ` + `_ 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 - ` + `_ Requires libraqm. .. versionadded:: 6.0.0 diff --git a/src/display.c b/src/display.c index 2eb4a5855..b8190db8c 100644 --- a/src/display.c +++ b/src/display.c @@ -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, diff --git a/tox.ini b/tox.ini index 81c6e19cf..2557d5067 100644 --- a/tox.ini +++ b/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 = diff --git a/winbuild/build.rst b/winbuild/build.rst index ba568a030..cd4a45e87 100644 --- a/winbuild/build.rst +++ b/winbuild/build.rst @@ -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 -------------- diff --git a/winbuild/build_prepare.py b/winbuild/build_prepare.py index 352c3f76b..178194ffe 100644 --- a/winbuild/build_prepare.py +++ b/winbuild/build_prepare.py @@ -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(), diff --git a/winbuild/fribidi.cmake b/winbuild/fribidi.cmake index 112174731..47ab2c329 100644 --- a/winbuild/fribidi.cmake +++ b/winbuild/fribidi.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) diff --git a/winbuild/raqm.cmake b/winbuild/raqm.cmake index e8e71800e..82c9cdc70 100644 --- a/winbuild/raqm.cmake +++ b/winbuild/raqm.cmake @@ -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)