Merge remote-tracking branch 'upstream/master' into rm-2.7

This commit is contained in:
Hugo 2019-11-16 17:10:10 +02:00
commit 12a725988e
20 changed files with 167 additions and 105 deletions

View File

@ -13,7 +13,8 @@ environment:
TEST_OPTIONS: TEST_OPTIONS:
DEPLOY: YES DEPLOY: YES
matrix: matrix:
- PYTHON: C:\Python38rc1-x64 - PYTHON: C:/Python38
- PYTHON: C:/Python38-x64
- PYTHON: C:/Python37 - PYTHON: C:/Python37
- PYTHON: C:/Python37-x64 - PYTHON: C:/Python37-x64
- PYTHON: C:/Python36 - PYTHON: C:/Python36
@ -32,11 +33,6 @@ environment:
install: install:
- ps: |
if ($env:PYTHON -eq "C:\Python38rc1-x64") {
curl -o install_python.ps1 https://raw.githubusercontent.com/matthew-brett/multibuild/d0cf77e62028704875073e3dc4626f61d1c33b0e/install_python.ps1
.\install_python.ps1
}
- curl -fsSL -o pillow-depends.zip https://github.com/python-pillow/pillow-depends/archive/master.zip - curl -fsSL -o pillow-depends.zip https://github.com/python-pillow/pillow-depends/archive/master.zip
- 7z x pillow-depends.zip -oc:\ - 7z x pillow-depends.zip -oc:\
- mv c:\pillow-depends-master c:\pillow-depends - mv c:\pillow-depends-master c:\pillow-depends
@ -80,6 +76,7 @@ build_script:
test_script: test_script:
- cd c:\pillow - cd c:\pillow
- '%PYTHON%\%PIP_DIR%\pip.exe install pytest pytest-cov' - '%PYTHON%\%PIP_DIR%\pip.exe 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-report term --cov-report xml Tests' - '%PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests'
#- '%PYTHON%\%EXECUTABLE% test-installed.py -v -s %TEST_OPTIONS%' TODO TEST_OPTIONS with pytest? #- '%PYTHON%\%EXECUTABLE% test-installed.py -v -s %TEST_OPTIONS%' TODO TEST_OPTIONS with pytest?

View File

@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
matrix: matrix:
python-version: ["3.7"] python-version: ["3.8"]
name: Python ${{ matrix.python-version }} name: Python ${{ matrix.python-version }}

View File

@ -5,11 +5,11 @@ on: [push, pull_request]
jobs: jobs:
build: build:
runs-on: windows-2016 runs-on: windows-2019
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
python-version: ["3.5", "3.6", "3.7", "pypy3.6"] python-version: ["3.5", "3.6", "3.7"]
architecture: ["x86", "x64"] architecture: ["x86", "x64"]
include: include:
- architecture: "x86" - architecture: "x86"
@ -43,6 +43,7 @@ jobs:
Write-Host "::set-env name=pythonLocation::$env:PYTHON" # new syntax https://github.com/actions/toolkit/blob/5bb77ec03fea98332e41f9347c8fbb1ce1e48f4a/docs/commands.md Write-Host "::set-env name=pythonLocation::$env:PYTHON" # new syntax https://github.com/actions/toolkit/blob/5bb77ec03fea98332e41f9347c8fbb1ce1e48f4a/docs/commands.md
New-Item -ItemType SymbolicLink -Path "$env:PYTHON\python.exe" -Target "$env:PYTHON\pypy3.exe" New-Item -ItemType SymbolicLink -Path "$env:PYTHON\python.exe" -Target "$env:PYTHON\pypy3.exe"
curl -fsSL -o get-pip.py https://bootstrap.pypa.io/get-pip.py curl -fsSL -o get-pip.py https://bootstrap.pypa.io/get-pip.py
$env:PATH = "$env:PYTHON\bin;$env:PATH"
& $env:PYTHON\python.exe get-pip.py & $env:PYTHON\python.exe get-pip.py
shell: pwsh shell: pwsh
@ -67,6 +68,12 @@ jobs:
Write-Host "`#`#[add-path]$env:RUNNER_WORKSPACE\nasm-2.14.02" Write-Host "`#`#[add-path]$env:RUNNER_WORKSPACE\nasm-2.14.02"
Write-Host "::add-path::$env:RUNNER_WORKSPACE\nasm-2.14.02" Write-Host "::add-path::$env:RUNNER_WORKSPACE\nasm-2.14.02"
# 32-bit should work on both platforms
curl -fsSL -o gs950.exe https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs950/gs950w32.exe
./gs950.exe /S
Write-Host "`#`#[add-path]C:\Program Files (x86)\gs\gs9.50\bin"
Write-Host "::add-path::C:\Program Files (x86)\gs\gs9.50\bin"
$env:PYTHON=$env:pythonLocation $env:PYTHON=$env:pythonLocation
curl -fsSL -o pillow-depends.zip https://github.com/python-pillow/pillow-depends/archive/master.zip curl -fsSL -o pillow-depends.zip https://github.com/python-pillow/pillow-depends/archive/master.zip
7z x pillow-depends.zip -oc:\ 7z x pillow-depends.zip -oc:\
@ -89,7 +96,7 @@ jobs:
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\jpeg-9c cd /D %BUILD%\jpeg-9c
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
echo on echo on
nmake -nologo -f makefile.vc setup-vc6 nmake -nologo -f makefile.vc setup-vc6
nmake -nologo -f makefile.vc clean nmake -nologo -f makefile.vc clean
@ -105,7 +112,7 @@ jobs:
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\libjpeg-turbo-2.0.3 cd /D %BUILD%\libjpeg-turbo-2.0.3
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
echo on echo on
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
set CMAKE=%CMAKE% -DENABLE_SHARED:BOOL=OFF -DWITH_JPEG8:BOOL=TRUE -DWITH_CRT_DLL:BOOL=TRUE -DCMAKE_BUILD_TYPE=Release set CMAKE=%CMAKE% -DENABLE_SHARED:BOOL=OFF -DWITH_JPEG8:BOOL=TRUE -DWITH_CRT_DLL:BOOL=TRUE -DCMAKE_BUILD_TYPE=Release
@ -124,7 +131,7 @@ jobs:
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\zlib-1.2.11 cd /D %BUILD%\zlib-1.2.11
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
echo on echo on
nmake -nologo -f win32\Makefile.msc clean nmake -nologo -f win32\Makefile.msc clean
nmake -nologo -f win32\Makefile.msc zlib.lib nmake -nologo -f win32\Makefile.msc zlib.lib
@ -138,8 +145,8 @@ jobs:
set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\tiff-4.0.10 cd /D %BUILD%\tiff-4.1.0
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
echo on echo on
copy %GITHUB_WORKSPACE%\winbuild\tiff.opt nmake.opt copy %GITHUB_WORKSPACE%\winbuild\tiff.opt nmake.opt
nmake -nologo -f makefile.vc clean nmake -nologo -f makefile.vc clean
@ -155,7 +162,7 @@ jobs:
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\libwebp-1.0.3 cd /D %BUILD%\libwebp-1.0.3
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
echo on echo on
rmdir /S /Q output\release-static rmdir /S /Q output\release-static
nmake -nologo -f Makefile.vc CFG=release-static OBJDIR=output ARCH=${{ matrix.architecture }} all nmake -nologo -f Makefile.vc CFG=release-static OBJDIR=output ARCH=${{ matrix.architecture }} all
@ -172,12 +179,12 @@ jobs:
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\freetype-2.10.1 cd /D %BUILD%\freetype-2.10.1
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
echo on echo on
rmdir /S /Q objs rmdir /S /Q objs
set DefaultPlatformToolset=v140 set DefaultPlatformToolset=v142
set VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets set VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\
set MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" set MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
powershell -Command "(gc builds\windows\vc2010\freetype.vcxproj) -replace 'MultiThreaded<', 'MultiThreadedDLL<' | Out-File -encoding ASCII builds\windows\vc2010\freetype.vcxproj" powershell -Command "(gc builds\windows\vc2010\freetype.vcxproj) -replace 'MultiThreaded<', 'MultiThreadedDLL<' | Out-File -encoding ASCII builds\windows\vc2010\freetype.vcxproj"
%MSBUILD% builds\windows\vc2010\freetype.sln /t:Build /p:Configuration="Release Static" /p:Platform=${{ matrix.platform-msbuild }} /m %MSBUILD% builds\windows\vc2010\freetype.sln /t:Build /p:Configuration="Release Static" /p:Platform=${{ matrix.platform-msbuild }} /m
xcopy /Y /E /Q include %INCLIB% xcopy /Y /E /Q include %INCLIB%
@ -190,13 +197,13 @@ jobs:
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\lcms2-2.8 cd /D %BUILD%\lcms2-2.8
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
echo on echo on
rmdir /S /Q Lib rmdir /S /Q Lib
rmdir /S /Q Projects\VC2015\Release rmdir /S /Q Projects\VC2015\Release
set VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets set VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\
set MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe" set MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
powershell -Command "(gc Projects\VC2015\lcms2_static\lcms2_static.vcxproj) -replace 'MultiThreaded<', 'MultiThreadedDLL<' | Out-File -encoding ASCII Projects\VC2015\lcms2_static\lcms2_static.vcxproj" powershell %GITHUB_WORKSPACE%\winbuild\lcms2_patch.ps1
%MSBUILD% Projects\VC2015\lcms2.sln /t:Clean;lcms2_static /p:Configuration="Release" /p:Platform=${{ matrix.platform-msbuild }} /m %MSBUILD% Projects\VC2015\lcms2.sln /t:Clean;lcms2_static /p:Configuration="Release" /p:Platform=${{ matrix.platform-msbuild }} /m
xcopy /Y /E /Q include %INCLIB% xcopy /Y /E /Q include %INCLIB%
copy /Y /B Lib\MS\*.lib %INCLIB% copy /Y /B Lib\MS\*.lib %INCLIB%
@ -208,7 +215,7 @@ jobs:
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\openjpeg-2.3.1msvcr10-x32 cd /D %BUILD%\openjpeg-2.3.1msvcr10-x32
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
echo on echo on
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
set CMAKE=%CMAKE% -DBUILD_THIRDPARTY:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF set CMAKE=%CMAKE% -DBUILD_THIRDPARTY:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF
@ -230,7 +237,7 @@ jobs:
set BUILD=%GITHUB_WORKSPACE%\winbuild\build set BUILD=%GITHUB_WORKSPACE%\winbuild\build
rem ba653c8: Merge tag '2.12.5' into msvc rem ba653c8: Merge tag '2.12.5' into msvc
cd /D %BUILD%\libimagequant-ba653c8ccb34dde4e21c6076d85a72d21ed9d971 cd /D %BUILD%\libimagequant-ba653c8ccb34dde4e21c6076d85a72d21ed9d971
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
echo on echo on
echo (gc CMakeLists.txt) -replace 'add_library', "add_compile_options(-openmp-)`r`nadd_library" ^| Out-File -encoding ASCII CMakeLists.txt > patch.ps1 echo (gc CMakeLists.txt) -replace 'add_library', "add_compile_options(-openmp-)`r`nadd_library" ^| Out-File -encoding ASCII CMakeLists.txt > patch.ps1
echo (gc CMakeLists.txt) -replace ' SHARED', ' STATIC' ^| Out-File -encoding ASCII CMakeLists.txt >> patch.ps1 echo (gc CMakeLists.txt) -replace ' SHARED', ' STATIC' ^| Out-File -encoding ASCII CMakeLists.txt >> patch.ps1
@ -254,7 +261,7 @@ jobs:
set INCLUDE=%INCLUDE%;%INCLIB% set INCLUDE=%INCLUDE%;%INCLIB%
set LIB=%LIB%;%INCLIB% set LIB=%LIB%;%INCLIB%
cd /D %BUILD%\harfbuzz-2.6.1 cd /D %BUILD%\harfbuzz-2.6.1
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
echo on echo on
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
set CMAKE=%CMAKE% -DHB_HAVE_FREETYPE:BOOL=ON -DCMAKE_BUILD_TYPE=Release set CMAKE=%CMAKE% -DHB_HAVE_FREETYPE:BOOL=ON -DCMAKE_BUILD_TYPE=Release
@ -273,7 +280,7 @@ jobs:
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\fribidi-1.0.7 cd /D %BUILD%\fribidi-1.0.7
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
echo on echo on
copy /Y /B %GITHUB_WORKSPACE%\winbuild\fribidi.cmake CMakeLists.txt copy /Y /B %GITHUB_WORKSPACE%\winbuild\fribidi.cmake CMakeLists.txt
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
@ -295,7 +302,7 @@ jobs:
set INCLUDE=%INCLUDE%;%INCLIB% set INCLUDE=%INCLUDE%;%INCLIB%
set LIB=%LIB%;%INCLIB% set LIB=%LIB%;%INCLIB%
cd /D %BUILD%\libraqm-0.7.0 cd /D %BUILD%\libraqm-0.7.0
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
echo on echo on
copy /Y /B %GITHUB_WORKSPACE%\winbuild\raqm.cmake CMakeLists.txt copy /Y /B %GITHUB_WORKSPACE%\winbuild\raqm.cmake CMakeLists.txt
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
@ -307,22 +314,6 @@ jobs:
copy /Y /B libraqm.dll %INCLIB% copy /Y /B libraqm.dll %INCLIB%
shell: cmd shell: cmd
- name: Build dependencies / ghostscript
run: |
set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
cd /D %BUILD%\ghostscript-9.27
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1
echo on
set MSVC_VERSION=14
set RCOMP="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\RC.Exe"
if "${{ matrix.architecture }}"=="x64" set WIN64=""
nmake -nologo -f psi\msvc.mak
rem Add bin to PATH variable: Copy to INCLIB, then add INCLIB to PATH in Test step.
copy /Y /B bin\* %INCLIB%
shell: cmd
- name: Build Pillow - name: Build Pillow
run: | run: |
set PYTHON=%pythonLocation% set PYTHON=%pythonLocation%
@ -332,18 +323,27 @@ jobs:
cd /D %GITHUB_WORKSPACE% cd /D %GITHUB_WORKSPACE%
set LIB=%INCLIB%;%PYTHON%\tcl set LIB=%INCLIB%;%PYTHON%\tcl
set INCLUDE=%INCLIB%;%GITHUB_WORKSPACE%\depends\tcl86\include;%INCLUDE% set INCLUDE=%INCLIB%;%GITHUB_WORKSPACE%\depends\tcl86\include;%INCLUDE%
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
set DISTUTILS_USE_SDK=1
set py_vcruntime_redist=true
%PYTHON%\python.exe setup.py build_ext install %PYTHON%\python.exe setup.py build_ext install
rem Add GhostScript and Raqm binaries (copied to INCLIB) to PATH. rem Add libraqm.dll (copied to INCLIB) to PATH.
path %INCLIB%;%PATH% path %INCLIB%;%PATH%
%PYTHON%\python.exe selftest.py --installed %PYTHON%\python.exe selftest.py --installed
shell: cmd shell: cmd
# failing with PyPy3
- name: Enable heap verification
if: "!contains(matrix.python-version, 'pypy')"
run: |
c:\"Program Files (x86)"\"Windows Kits"\10\Debuggers\x86\gflags.exe /p /enable %PYTHON%\python.exe
shell: cmd
- name: Test Pillow - name: Test Pillow
run: | run: |
set PYTHON=%pythonLocation% set PYTHON=%pythonLocation%
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
rem Add GhostScript and Raqm binaries (copied to INCLIB) to PATH. rem Add libraqm.dll (copied to INCLIB) to PATH.
path %INCLIB%;%PATH% path %INCLIB%;%PATH%
cd /D %GITHUB_WORKSPACE% cd /D %GITHUB_WORKSPACE%
%PYTHON%\python.exe -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests %PYTHON%\python.exe -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests
@ -366,7 +366,7 @@ jobs:
cd /D %GITHUB_WORKSPACE% cd /D %GITHUB_WORKSPACE%
set LIB=%INCLIB%;%PYTHON%\tcl set LIB=%INCLIB%;%PYTHON%\tcl
set INCLUDE=%INCLIB%;%GITHUB_WORKSPACE%\depends\tcl86\include;%INCLUDE% set INCLUDE=%INCLIB%;%GITHUB_WORKSPACE%\depends\tcl86\include;%INCLUDE%
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
%PYTHON%\python.exe setup.py bdist_wheel %PYTHON%\python.exe setup.py bdist_wheel
shell: cmd shell: cmd

View File

@ -9,14 +9,15 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ os: [
"ubuntu-18.04", "ubuntu-latest",
"macOS-10.14", "macOS-latest",
] ]
python-version: [ python-version: [
"pypy3", "pypy3",
"3.8",
"3.7", "3.7",
"3.5",
"3.6", "3.6",
"3.5",
] ]
include: include:
- python-version: "3.5" - python-version: "3.5"
@ -53,7 +54,7 @@ jobs:
.travis/test.sh .travis/test.sh
- name: Docs - name: Docs
if: matrix.python-version == 3.7 if: matrix.python-version == 3.8
run: | run: |
pip install sphinx-rtd-theme pip install sphinx-rtd-theme
make doccheck make doccheck

View File

@ -5,6 +5,21 @@ Changelog (Pillow)
7.0.0 (unreleased) 7.0.0 (unreleased)
------------------ ------------------
- Fixed freeing unallocated pointer when resizing with height too large #4116
[radarhere]
- Copy info in Image.transform #4128
[radarhere]
- Corrected DdsImagePlugin setting info gamma #4171
[radarhere]
- Depends: Update libtiff to 4.1.0 #4195
[radarhere]
- Improve handling of file resources #3577
[jdufresne]
- Removed CI testing of Fedora 29 #4165 - Removed CI testing of Fedora 29 #4165
[hugovk] [hugovk]

11
Tests/conftest.py Normal file
View File

@ -0,0 +1,11 @@
def pytest_report_header(config):
import io
try:
from PIL import features
with io.StringIO() as out:
features.pilinfo(out=out, supported_formats=False)
return out.getvalue()
except Exception as e:
return "pytest_report_header failed: %s" % str(e)

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

View File

@ -8,6 +8,7 @@ TEST_FILE_DXT1 = "Tests/images/dxt1-rgb-4bbp-noalpha_MipMaps-1.dds"
TEST_FILE_DXT3 = "Tests/images/dxt3-argb-8bbp-explicitalpha_MipMaps-1.dds" 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_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 = "Tests/images/bc7-argb-8bpp_MipMaps-1.dds"
TEST_FILE_DX10_BC7_UNORM_SRGB = "Tests/images/DXGI_FORMAT_BC7_UNORM_SRGB.dds"
TEST_FILE_UNCOMPRESSED_RGB = "Tests/images/uncompressed_rgb.dds" TEST_FILE_UNCOMPRESSED_RGB = "Tests/images/uncompressed_rgb.dds"
@ -69,6 +70,21 @@ class TestFileDds(PillowTestCase):
self.assert_image_equal(target, im) self.assert_image_equal(target, im)
def test_dx10_bc7_unorm_srgb(self):
"""Check DX10 unsigned normalized integer images can be opened"""
target = Image.open(TEST_FILE_DX10_BC7_UNORM_SRGB.replace(".dds", ".png"))
im = Image.open(TEST_FILE_DX10_BC7_UNORM_SRGB)
im.load()
self.assertEqual(im.format, "DDS")
self.assertEqual(im.mode, "RGBA")
self.assertEqual(im.size, (16, 16))
self.assertEqual(im.info["gamma"], 1 / 2.2)
self.assert_image_equal(target, im)
def test_unimplemented_dxgi_format(self): def test_unimplemented_dxgi_format(self):
self.assertRaises( self.assertRaises(
NotImplementedError, NotImplementedError,

View File

@ -36,9 +36,8 @@ class TestImagePsd(PillowTestCase):
def test_context_manager(self): def test_context_manager(self):
def open(): def open():
im = Image.open(test_file) with Image.open(test_file) as im:
im.load() im.load()
im.close()
self.assert_warning(None, open) self.assert_warning(None, open)

View File

@ -9,11 +9,15 @@ class TestImagingResampleVulnerability(PillowTestCase):
# see https://github.com/python-pillow/Pillow/issues/1710 # see https://github.com/python-pillow/Pillow/issues/1710
def test_overflow(self): def test_overflow(self):
im = hopper("L") im = hopper("L")
xsize = 0x100000008 // 4 size_too_large = 0x100000008 // 4
ysize = 1000 # unimportant size_normal = 1000 # unimportant
with self.assertRaises(MemoryError): for xsize, ysize in (
# any resampling filter will do here (size_too_large, size_normal),
im.im.resize((xsize, ysize), Image.BILINEAR) (size_normal, size_too_large),
):
with self.assertRaises(MemoryError):
# any resampling filter will do here
im.im.resize((xsize, ysize), Image.BILINEAR)
def test_invalid_size(self): def test_invalid_size(self):
im = hopper() im = hopper()

View File

@ -1,14 +1,12 @@
import math import math
from PIL import Image from PIL import Image, ImageTransform
from .helper import PillowTestCase, hopper from .helper import PillowTestCase, hopper
class TestImageTransform(PillowTestCase): class TestImageTransform(PillowTestCase):
def test_sanity(self): def test_sanity(self):
from PIL import ImageTransform
im = Image.new("L", (100, 100)) im = Image.new("L", (100, 100))
seq = tuple(range(10)) seq = tuple(range(10))
@ -22,6 +20,16 @@ class TestImageTransform(PillowTestCase):
transform = ImageTransform.MeshTransform([(seq[:4], seq[:8])]) transform = ImageTransform.MeshTransform([(seq[:4], seq[:8])])
im.transform((100, 100), transform) im.transform((100, 100), transform)
def test_info(self):
comment = b"File written by Adobe Photoshop\xa8 4.0"
im = Image.open("Tests/images/hopper.gif")
self.assertEqual(im.info["comment"], comment)
transform = ImageTransform.ExtentTransform((0, 0, 0, 0))
new_im = im.transform((100, 100), transform)
self.assertEqual(new_im.info["comment"], comment)
def test_extent(self): def test_extent(self):
im = hopper("RGB") im = hopper("RGB")
(w, h) = im.size (w, h) = im.size

View File

@ -2,7 +2,7 @@
# Create and test a Python package on multiple Python versions. # Create and test a Python package on multiple Python versions.
# Add steps that analyze code, save the dist with the build record, # Add steps that analyze code, save the dist with the build record,
# publish to a PyPI-compatible index, and more: # publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/python # https://docs.microsoft.com/azure/devops/pipelines/ecosystems/python
jobs: jobs:

View File

@ -19,11 +19,31 @@ from distutils.command.build_ext import build_ext
from setuptools import Extension, setup from setuptools import Extension, setup
def get_version():
version_file = "src/PIL/_version.py"
with open(version_file, "r") as f:
exec(compile(f.read(), version_file, "exec"))
return locals()["__version__"]
NAME = "Pillow"
PILLOW_VERSION = get_version()
FREETYPE_ROOT = None
IMAGEQUANT_ROOT = None
JPEG2K_ROOT = None
JPEG_ROOT = None
LCMS_ROOT = None
TIFF_ROOT = None
ZLIB_ROOT = None
if sys.platform == "win32" and sys.version_info >= (3, 9): if sys.platform == "win32" and sys.version_info >= (3, 9):
warnings.warn( warnings.warn(
"Pillow does not yet support Python {}.{} and does not yet provide " "Pillow {} does not support Python {}.{} and does not provide prebuilt "
"prebuilt Windows binaries. We do not recommend building from " "Windows binaries. We do not recommend building from source on Windows.".format(
"source on Windows.".format(sys.version_info.major, sys.version_info.minor), PILLOW_VERSION, sys.version_info.major, sys.version_info.minor
),
RuntimeWarning, RuntimeWarning,
) )
@ -228,24 +248,6 @@ def _read(file):
return fp.read() return fp.read()
def get_version():
version_file = "src/PIL/_version.py"
with open(version_file, "r") as f:
exec(compile(f.read(), version_file, "exec"))
return locals()["__version__"]
NAME = "Pillow"
PILLOW_VERSION = get_version()
JPEG_ROOT = None
JPEG2K_ROOT = None
ZLIB_ROOT = None
IMAGEQUANT_ROOT = None
TIFF_ROOT = None
FREETYPE_ROOT = None
LCMS_ROOT = None
def _pkg_config(name): def _pkg_config(name):
try: try:
command = os.environ.get("PKG_CONFIG", "pkg-config") command = os.environ.get("PKG_CONFIG", "pkg-config")
@ -854,7 +856,12 @@ try:
license="HPND", license="HPND",
author="Alex Clark (PIL Fork Author)", author="Alex Clark (PIL Fork Author)",
author_email="aclark@python-pillow.org", author_email="aclark@python-pillow.org",
url="http://python-pillow.org", url="https://python-pillow.org",
project_urls={
"Documentation": "https://pillow.readthedocs.io",
"Source": "https://github.com/python-pillow/Pillow",
"Funding": "https://tidelift.com/subscription/pkg/pypi-pillow",
},
classifiers=[ classifiers=[
"Development Status :: 6 - Mature", "Development Status :: 6 - Mature",
"License :: OSI Approved :: Historical Permission Notice and Disclaimer (HPND)", # noqa: E501 "License :: OSI Approved :: Historical Permission Notice and Disclaimer (HPND)", # noqa: E501

View File

@ -155,7 +155,7 @@ class DdsImageFile(ImageFile.ImageFile):
n = 7 n = 7
elif dxgi_format == DXGI_FORMAT_BC7_UNORM_SRGB: elif dxgi_format == DXGI_FORMAT_BC7_UNORM_SRGB:
self.pixel_format = "BC7" self.pixel_format = "BC7"
self.im_info["gamma"] = 1 / 2.2 self.info["gamma"] = 1 / 2.2
n = 7 n = 7
else: else:
raise NotImplementedError( raise NotImplementedError(

View File

@ -2231,6 +2231,7 @@ class Image:
raise ValueError("missing method data") raise ValueError("missing method data")
im = new(self.mode, size, fillcolor) im = new(self.mode, size, fillcolor)
im.info = self.info.copy()
if method == MESH: if method == MESH:
# list of quads # list of quads
for box, quad in data: for box, quad in data:

View File

@ -298,25 +298,21 @@ class IFDRational(Rational):
float/rational/other number, or an IFDRational float/rational/other number, or an IFDRational
:param denominator: Optional integer denominator :param denominator: Optional integer denominator
""" """
self._denominator = denominator if isinstance(value, IFDRational):
self._numerator = value self._numerator = value.numerator
self._val = float(1) self._denominator = value.denominator
self._val = value._val
return
if isinstance(value, Fraction): if isinstance(value, Fraction):
self._numerator = value.numerator self._numerator = value.numerator
self._denominator = value.denominator self._denominator = value.denominator
self._val = value else:
self._numerator = value
if isinstance(value, IFDRational): self._denominator = denominator
self._denominator = value.denominator
self._numerator = value.numerator
self._val = value._val
return
if denominator == 0: if denominator == 0:
self._val = float("nan") self._val = float("nan")
return
elif denominator == 1: elif denominator == 1:
self._val = Fraction(value) self._val = Fraction(value)
else: else:

View File

@ -627,8 +627,6 @@ ImagingResampleInner(Imaging imIn, int xsize, int ysize,
if ( ! ksize_vert) { if ( ! ksize_vert) {
free(bounds_horiz); free(bounds_horiz);
free(kk_horiz); free(kk_horiz);
free(bounds_vert);
free(kk_vert);
return NULL; return NULL;
} }

View File

@ -8,7 +8,7 @@ pythons = {
"36": {"compiler": 7.1, "vc": 2015}, "36": {"compiler": 7.1, "vc": 2015},
"pypy3": {"compiler": 7.1, "vc": 2015}, "pypy3": {"compiler": 7.1, "vc": 2015},
"37": {"compiler": 7.1, "vc": 2015}, "37": {"compiler": 7.1, "vc": 2015},
"38rc1-x64": {"compiler": 7.1, "vc": 2015}, "38": {"compiler": 7.1, "vc": 2015},
# for GitHub Actions # for GitHub Actions
"3.5": {"compiler": 7.1, "vc": 2015}, "3.5": {"compiler": 7.1, "vc": 2015},
"3.6": {"compiler": 7.1, "vc": 2015}, "3.6": {"compiler": 7.1, "vc": 2015},
@ -34,9 +34,9 @@ libs = {
"dir": "jpeg-9c", "dir": "jpeg-9c",
}, },
"tiff": { "tiff": {
"url": "ftp://download.osgeo.org/libtiff/tiff-4.0.10.tar.gz", "url": "ftp://download.osgeo.org/libtiff/tiff-4.1.0.tar.gz",
"filename": "tiff-4.0.10.tar.gz", "filename": "tiff-4.1.0.tar.gz",
"dir": "tiff-4.0.10", "dir": "tiff-4.1.0",
}, },
"freetype": { "freetype": {
"url": "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.gz", # noqa: E501 "url": "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.gz", # noqa: E501

9
winbuild/lcms2_patch.ps1 Normal file
View File

@ -0,0 +1,9 @@
Get-ChildItem .\Projects\VC2015\ *.vcxproj -recurse |
Foreach-Object {
$c = ($_ | Get-Content)
$c = $c -replace 'MultiThreaded<','MultiThreadedDLL<'
$c = $c -replace '<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>','<WindowsTargetPlatformVersion>10</WindowsTargetPlatformVersion>'
$c = $c -replace '<PlatformToolset>v140</PlatformToolset>','<PlatformToolset>v142</PlatformToolset>'
[IO.File]::WriteAllText($_.FullName, ($c -join "`r`n"))
}