Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
radarhere committed Jun 29, 2021
2 parents ce10281 + 28330c2 commit d81c5bd
Show file tree
Hide file tree
Showing 429 changed files with 23,409 additions and 16,880 deletions.
9 changes: 5 additions & 4 deletions .appveyor.yml
Expand Up @@ -23,16 +23,16 @@ install:
- 7z x pillow-depends.zip -oc:\
- mv c:\pillow-depends-master c:\pillow-depends
- 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%
- 7z x ..\pillow-depends\nasm-2.15.05-win64.zip -oc:\
- ..\pillow-depends\gs9540w32.exe /S
- path c:\nasm-2.15.05;C:\Program Files (x86)\gs\gs9.54.0\bin;%PATH%
- cd c:\pillow\winbuild\
- ps: |
c:\python37\python.exe c:\pillow\winbuild\build_prepare.py -v --depends=C:\pillow-depends\
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"'
- '%PYTHON%\%EXECUTABLE% -m pip install -U setuptools'

build_script:
- ps: |
Expand All @@ -45,6 +45,7 @@ test_script:
- cd c:\pillow
- '%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% -c "from PIL import Image"'
- '%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?

Expand Down
5 changes: 1 addition & 4 deletions .ci/install.sh
Expand Up @@ -27,15 +27,12 @@ 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 -U pytest-timeout
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 includes setuptools 49.3.2+:
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

# PyQt5 doesn't support PyPy3
# Wheel doesn't yet support 3.10
if [[ $GHA_PYTHON_VERSION == 3.* && $GHA_PYTHON_VERSION != "3.10-dev" ]]; then
Expand Down
4 changes: 3 additions & 1 deletion .ci/test.sh
Expand Up @@ -2,4 +2,6 @@

set -e

python -bb -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term Tests
python3 -c "from PIL import Image"

python3 -bb -m pytest -v -x -W always --cov PIL --cov Tests --cov-report term Tests $REVERSE
20 changes: 20 additions & 0 deletions .clang-format
@@ -0,0 +1,20 @@
# A clang-format style that approximates Python's PEP 7
# Useful for IDE integration
BasedOnStyle: Google
AlwaysBreakAfterReturnType: All
AllowShortIfStatementsOnASingleLine: false
AlignAfterOpenBracket: AlwaysBreak
BinPackArguments: false
BinPackParameters: false
BreakBeforeBraces: Attach
ColumnLimit: 88
DerivePointerAlignment: false
IndentWidth: 4
Language: Cpp
PointerAlignment: Right
ReflowComments: true
SortIncludes: false
SpaceBeforeParens: ControlStatements
SpacesInParentheses: false
TabWidth: 4
UseTab: Never
1 change: 1 addition & 0 deletions .github/CONTRIBUTING.md
Expand Up @@ -18,6 +18,7 @@ Please send a pull request to the master branch. Please include [documentation](
- 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 AppVeyor.
- Include [release notes](https://github.com/python-pillow/Pillow/tree/master/docs/releasenotes) as needed or appropriate with your bug fixes, feature additions and tests.

## Reporting Issues

Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/cifuzz.yml
@@ -0,0 +1,47 @@
name: CIFuzz
on:
push:
paths:
- "**.c"
- "**.h"
pull_request:
paths:
- "**.c"
- "**.h"

jobs:
Fuzzing:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'pillow'
language: python
dry-run: false
- name: Run Fuzzers
id: run
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'pillow'
fuzz-seconds: 600
language: python
dry-run: false
- name: Upload New Crash
uses: actions/upload-artifact@v2
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
path: ./out/artifacts
- name: Upload Legacy Crash
uses: actions/upload-artifact@v2
if: steps.run.outcome == 'success'
with:
name: crash
path: ./out/crash*
- name: Fail on legacy crash
if: success()
run: |
[ ! -e out/crash-* ]
echo No legacy crash detected
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Expand Up @@ -34,12 +34,12 @@ jobs:
python-version: 3.8

- name: Build system information
run: python .github/workflows/system-info.py
run: python3 .github/workflows/system-info.py

- name: Install dependencies
run: |
python -m pip install -U pip
python -m pip install -U tox
python3 -m pip install -U pip
python3 -m pip install -U tox
- name: Lint
run: tox -e lint
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/macos-install.sh
Expand Up @@ -9,16 +9,13 @@ 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 -U pytest-timeout
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
# 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 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
4 changes: 2 additions & 2 deletions .github/workflows/test-docker.yml
Expand Up @@ -21,8 +21,8 @@ jobs:
centos-7-amd64,
centos-8-amd64,
debian-10-buster-x86,
fedora-32-amd64,
fedora-33-amd64,
fedora-34-amd64,
ubuntu-18.04-bionic-amd64,
ubuntu-20.04-focal-amd64,
]
Expand All @@ -41,7 +41,7 @@ jobs:
- uses: actions/checkout@v2

- name: Build system information
run: python .github/workflows/system-info.py
run: python3 .github/workflows/system-info.py

- name: Set up QEMU
if: "matrix.qemu-arch"
Expand Down
52 changes: 52 additions & 0 deletions .github/workflows/test-valgrind.yml
@@ -0,0 +1,52 @@
name: Test Valgrind

# like the docker tests, but running valgrind only on *.c/*.h changes.

on:
push:
paths:
- "**.c"
- "**.h"
pull_request:
paths:
- "**.c"
- "**.h"

jobs:
build:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
docker: [
ubuntu-20.04-focal-amd64-valgrind,
]
dockerTag: [master]

name: ${{ matrix.docker }}

steps:
- uses: actions/checkout@v2

- name: Build system information
run: python3 .github/workflows/system-info.py

- name: Docker pull
run: |
docker pull pythonpillow/${{ matrix.docker }}:${{ matrix.dockerTag }}
- name: Build and Run Valgrind
run: |
# The Pillow user in the docker container is UID 1000
sudo chown -R 1000 $GITHUB_WORKSPACE
docker run --name pillow_container -v $GITHUB_WORKSPACE:/Pillow pythonpillow/${{ matrix.docker }}:${{ matrix.dockerTag }}
sudo chown -R runner $GITHUB_WORKSPACE
success:
needs: build
runs-on: ubuntu-latest
name: Valgrind Test Successful
steps:
- name: Success
run: echo Valgrind Test Successful
51 changes: 17 additions & 34 deletions .github/workflows/test-windows.yml
Expand Up @@ -8,19 +8,13 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["pypy-3.6", "pypy-3.7", "3.6", "3.7", "3.8", "3.9", "3.10-dev"]
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10-dev"]
architecture: ["x86", "x64"]
include:
- architecture: "x86"
platform-vcvars: "x86"
platform-msbuild: "Win32"
- architecture: "x64"
platform-vcvars: "x86_amd64"
platform-msbuild: "x64"
exclude:
# PyPy does not support 64-bit on Windows
# PyPy3.6 only ships 32-bit binaries for Windows
- python-version: "pypy-3.6"
architecture: "x64"
architecture: "x86"
# PyPy 7.3.4+ only ships 64-bit binaries for Windows
- python-version: "pypy-3.7"
architecture: "x64"
timeout-minutes: 30
Expand Down Expand Up @@ -57,22 +51,17 @@ jobs:
- name: Print build system information
run: python .github/workflows/system-info.py

- 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+:
- name: Upgrade setuptools
if: "contains(matrix.python-version, '3.8') || contains(matrix.python-version, '3.9')"
run: python -m pip install -U "setuptools>=49.3.2"
- name: python -m pip install wheel pytest pytest-cov pytest-timeout
run: python -m pip install wheel pytest pytest-cov pytest-timeout

- 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
7z x winbuild\depends\nasm-2.15.05-win64.zip "-o$env:RUNNER_WORKSPACE\"
echo "$env:RUNNER_WORKSPACE\nasm-2.15.05" >> $env:GITHUB_PATH
winbuild\depends\gs9533w32.exe /S
echo "C:\Program Files (x86)\gs\gs9.53.3\bin" >> $env:GITHUB_PATH
winbuild\depends\gs9540w32.exe /S
echo "C:\Program Files (x86)\gs\gs9.54.0\bin" >> $env:GITHUB_PATH
xcopy /S /Y winbuild\depends\test_images\* Tests\images\
Expand Down Expand Up @@ -110,7 +99,7 @@ jobs:
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_libwebp.cmd"

# for FreeType CBDT font support
# for FreeType CBDT/SBIX font support
- name: Build dependencies / libpng
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_libpng.cmd"
Expand All @@ -137,14 +126,11 @@ jobs:
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_harfbuzz.cmd"

# Raqm dependencies
- 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"

# trim ~150MB x 9
- name: Optimize build cache
if: steps.build-cache.outputs.cache-hit != 'true'
Expand Down Expand Up @@ -174,7 +160,7 @@ jobs:
if: failure()
run: |
mkdir -p Tests/errors
shell: pwsh
shell: bash

- name: Upload errors
uses: actions/upload-artifact@v2
Expand All @@ -197,16 +183,14 @@ jobs:

- name: Build wheel
id: wheel
# 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')"
if: "github.event_name == 'push'"
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
# 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')"
if: "github.event_name == 'push'"
with:
name: ${{ steps.wheel.outputs.dist }}
path: dist\*.whl
Expand Down Expand Up @@ -251,8 +235,6 @@ jobs:
${{ matrix.package }}-python3-olefile \
${{ matrix.package }}-python3-pip \
${{ matrix.package }}-python3-pyqt5 \
${{ matrix.package }}-python3-pytest \
${{ matrix.package }}-python3-pytest-cov \
${{ matrix.package }}-python3-setuptools \
${{ matrix.package }}-freetype \
${{ matrix.package }}-ghostscript \
Expand All @@ -265,7 +247,7 @@ jobs:
${{ matrix.package }}-openjpeg2 \
subversion
python3 -m pip install pyroma
python3 -m pip install pyroma pytest pytest-cov
pushd depends && ./install_extra_test_images.sh && popd
Expand All @@ -275,6 +257,7 @@ jobs:
- name: Test Pillow
run: |
python3 selftest.py --installed
python3 -c "from PIL import Image"
python3 -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests
- name: Upload coverage
Expand Down

0 comments on commit d81c5bd

Please sign in to comment.