mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 17:36:18 +03:00
Merge remote-tracking branch 'upstream/master' into rm-2.7
This commit is contained in:
commit
12a725988e
|
@ -13,7 +13,8 @@ environment:
|
|||
TEST_OPTIONS:
|
||||
DEPLOY: YES
|
||||
matrix:
|
||||
- PYTHON: C:\Python38rc1-x64
|
||||
- PYTHON: C:/Python38
|
||||
- PYTHON: C:/Python38-x64
|
||||
- PYTHON: C:/Python37
|
||||
- PYTHON: C:/Python37-x64
|
||||
- PYTHON: C:/Python36
|
||||
|
@ -32,11 +33,6 @@ environment:
|
|||
|
||||
|
||||
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
|
||||
- 7z x pillow-depends.zip -oc:\
|
||||
- mv c:\pillow-depends-master c:\pillow-depends
|
||||
|
@ -80,6 +76,7 @@ build_script:
|
|||
test_script:
|
||||
- cd c:\pillow
|
||||
- '%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% test-installed.py -v -s %TEST_OPTIONS%' TODO TEST_OPTIONS with pytest?
|
||||
|
||||
|
|
2
.github/workflows/lint.yml
vendored
2
.github/workflows/lint.yml
vendored
|
@ -8,7 +8,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: ["3.7"]
|
||||
python-version: ["3.8"]
|
||||
|
||||
name: Python ${{ matrix.python-version }}
|
||||
|
||||
|
|
82
.github/workflows/test-windows.yml
vendored
82
.github/workflows/test-windows.yml
vendored
|
@ -5,11 +5,11 @@ on: [push, pull_request]
|
|||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: windows-2016
|
||||
runs-on: windows-2019
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
python-version: ["3.5", "3.6", "3.7", "pypy3.6"]
|
||||
python-version: ["3.5", "3.6", "3.7"]
|
||||
architecture: ["x86", "x64"]
|
||||
include:
|
||||
- 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
|
||||
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
|
||||
$env:PATH = "$env:PYTHON\bin;$env:PATH"
|
||||
& $env:PYTHON\python.exe get-pip.py
|
||||
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"
|
||||
|
||||
# 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
|
||||
curl -fsSL -o pillow-depends.zip https://github.com/python-pillow/pillow-depends/archive/master.zip
|
||||
7z x pillow-depends.zip -oc:\
|
||||
|
@ -89,7 +96,7 @@ jobs:
|
|||
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
|
||||
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
|
||||
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
|
||||
nmake -nologo -f makefile.vc setup-vc6
|
||||
nmake -nologo -f makefile.vc clean
|
||||
|
@ -105,7 +112,7 @@ jobs:
|
|||
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
|
||||
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
|
||||
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
|
||||
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
|
||||
|
@ -124,7 +131,7 @@ jobs:
|
|||
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
|
||||
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
|
||||
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
|
||||
nmake -nologo -f win32\Makefile.msc clean
|
||||
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 INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
|
||||
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
|
||||
cd /D %BUILD%\tiff-4.0.10
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1
|
||||
cd /D %BUILD%\tiff-4.1.0
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.platform-vcvars }}
|
||||
echo on
|
||||
copy %GITHUB_WORKSPACE%\winbuild\tiff.opt nmake.opt
|
||||
nmake -nologo -f makefile.vc clean
|
||||
|
@ -155,7 +162,7 @@ jobs:
|
|||
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
|
||||
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
|
||||
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
|
||||
rmdir /S /Q output\release-static
|
||||
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 BUILD=%GITHUB_WORKSPACE%\winbuild\build
|
||||
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
|
||||
rmdir /S /Q objs
|
||||
set DefaultPlatformToolset=v140
|
||||
set VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets
|
||||
set MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\MSBuild.exe"
|
||||
set DefaultPlatformToolset=v142
|
||||
set VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\
|
||||
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"
|
||||
%MSBUILD% builds\windows\vc2010\freetype.sln /t:Build /p:Configuration="Release Static" /p:Platform=${{ matrix.platform-msbuild }} /m
|
||||
xcopy /Y /E /Q include %INCLIB%
|
||||
|
@ -190,13 +197,13 @@ jobs:
|
|||
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
|
||||
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
|
||||
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
|
||||
rmdir /S /Q Lib
|
||||
rmdir /S /Q Projects\VC2015\Release
|
||||
set VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets
|
||||
set MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\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"
|
||||
set VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Microsoft\VC\v160\
|
||||
set MSBUILD="C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\MSBuild.exe"
|
||||
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
|
||||
xcopy /Y /E /Q include %INCLIB%
|
||||
copy /Y /B Lib\MS\*.lib %INCLIB%
|
||||
|
@ -208,7 +215,7 @@ jobs:
|
|||
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
|
||||
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
|
||||
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
|
||||
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
|
||||
|
@ -230,7 +237,7 @@ jobs:
|
|||
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
|
||||
rem ba653c8: Merge tag '2.12.5' into msvc
|
||||
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 (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
|
||||
|
@ -254,7 +261,7 @@ jobs:
|
|||
set INCLUDE=%INCLUDE%;%INCLIB%
|
||||
set LIB=%LIB%;%INCLIB%
|
||||
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
|
||||
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
|
||||
|
@ -273,7 +280,7 @@ jobs:
|
|||
set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32
|
||||
set BUILD=%GITHUB_WORKSPACE%\winbuild\build
|
||||
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
|
||||
copy /Y /B %GITHUB_WORKSPACE%\winbuild\fribidi.cmake CMakeLists.txt
|
||||
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
|
||||
|
@ -295,7 +302,7 @@ jobs:
|
|||
set INCLUDE=%INCLUDE%;%INCLIB%
|
||||
set LIB=%LIB%;%INCLIB%
|
||||
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
|
||||
copy /Y /B %GITHUB_WORKSPACE%\winbuild\raqm.cmake CMakeLists.txt
|
||||
set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF
|
||||
|
@ -307,22 +314,6 @@ jobs:
|
|||
copy /Y /B libraqm.dll %INCLIB%
|
||||
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
|
||||
run: |
|
||||
set PYTHON=%pythonLocation%
|
||||
|
@ -332,18 +323,27 @@ jobs:
|
|||
cd /D %GITHUB_WORKSPACE%
|
||||
set LIB=%INCLIB%;%PYTHON%\tcl
|
||||
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
|
||||
rem Add GhostScript and Raqm binaries (copied to INCLIB) to PATH.
|
||||
rem Add libraqm.dll (copied to INCLIB) to PATH.
|
||||
path %INCLIB%;%PATH%
|
||||
%PYTHON%\python.exe selftest.py --installed
|
||||
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
|
||||
run: |
|
||||
set PYTHON=%pythonLocation%
|
||||
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%
|
||||
cd /D %GITHUB_WORKSPACE%
|
||||
%PYTHON%\python.exe -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests
|
||||
|
@ -366,7 +366,7 @@ jobs:
|
|||
cd /D %GITHUB_WORKSPACE%
|
||||
set LIB=%INCLIB%;%PYTHON%\tcl
|
||||
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
|
||||
shell: cmd
|
||||
|
||||
|
|
9
.github/workflows/test.yml
vendored
9
.github/workflows/test.yml
vendored
|
@ -9,14 +9,15 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os: [
|
||||
"ubuntu-18.04",
|
||||
"macOS-10.14",
|
||||
"ubuntu-latest",
|
||||
"macOS-latest",
|
||||
]
|
||||
python-version: [
|
||||
"pypy3",
|
||||
"3.8",
|
||||
"3.7",
|
||||
"3.5",
|
||||
"3.6",
|
||||
"3.5",
|
||||
]
|
||||
include:
|
||||
- python-version: "3.5"
|
||||
|
@ -53,7 +54,7 @@ jobs:
|
|||
.travis/test.sh
|
||||
|
||||
- name: Docs
|
||||
if: matrix.python-version == 3.7
|
||||
if: matrix.python-version == 3.8
|
||||
run: |
|
||||
pip install sphinx-rtd-theme
|
||||
make doccheck
|
||||
|
|
15
CHANGES.rst
15
CHANGES.rst
|
@ -5,6 +5,21 @@ Changelog (Pillow)
|
|||
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
|
||||
[hugovk]
|
||||
|
||||
|
|
11
Tests/conftest.py
Normal file
11
Tests/conftest.py
Normal 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)
|
BIN
Tests/images/DXGI_FORMAT_BC7_UNORM_SRGB.dds
Normal file
BIN
Tests/images/DXGI_FORMAT_BC7_UNORM_SRGB.dds
Normal file
Binary file not shown.
BIN
Tests/images/DXGI_FORMAT_BC7_UNORM_SRGB.png
Normal file
BIN
Tests/images/DXGI_FORMAT_BC7_UNORM_SRGB.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 106 B |
|
@ -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_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_UNCOMPRESSED_RGB = "Tests/images/uncompressed_rgb.dds"
|
||||
|
||||
|
||||
|
@ -69,6 +70,21 @@ class TestFileDds(PillowTestCase):
|
|||
|
||||
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):
|
||||
self.assertRaises(
|
||||
NotImplementedError,
|
||||
|
|
|
@ -36,9 +36,8 @@ class TestImagePsd(PillowTestCase):
|
|||
|
||||
def test_context_manager(self):
|
||||
def open():
|
||||
im = Image.open(test_file)
|
||||
im.load()
|
||||
im.close()
|
||||
with Image.open(test_file) as im:
|
||||
im.load()
|
||||
|
||||
self.assert_warning(None, open)
|
||||
|
||||
|
|
|
@ -9,11 +9,15 @@ class TestImagingResampleVulnerability(PillowTestCase):
|
|||
# see https://github.com/python-pillow/Pillow/issues/1710
|
||||
def test_overflow(self):
|
||||
im = hopper("L")
|
||||
xsize = 0x100000008 // 4
|
||||
ysize = 1000 # unimportant
|
||||
with self.assertRaises(MemoryError):
|
||||
# any resampling filter will do here
|
||||
im.im.resize((xsize, ysize), Image.BILINEAR)
|
||||
size_too_large = 0x100000008 // 4
|
||||
size_normal = 1000 # unimportant
|
||||
for xsize, ysize in (
|
||||
(size_too_large, size_normal),
|
||||
(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):
|
||||
im = hopper()
|
||||
|
|
|
@ -1,14 +1,12 @@
|
|||
import math
|
||||
|
||||
from PIL import Image
|
||||
from PIL import Image, ImageTransform
|
||||
|
||||
from .helper import PillowTestCase, hopper
|
||||
|
||||
|
||||
class TestImageTransform(PillowTestCase):
|
||||
def test_sanity(self):
|
||||
from PIL import ImageTransform
|
||||
|
||||
im = Image.new("L", (100, 100))
|
||||
|
||||
seq = tuple(range(10))
|
||||
|
@ -22,6 +20,16 @@ class TestImageTransform(PillowTestCase):
|
|||
transform = ImageTransform.MeshTransform([(seq[:4], seq[:8])])
|
||||
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):
|
||||
im = hopper("RGB")
|
||||
(w, h) = im.size
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Create and test a Python package on multiple Python versions.
|
||||
# Add steps that analyze code, save the dist with the build record,
|
||||
# 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:
|
||||
|
||||
|
|
51
setup.py
51
setup.py
|
@ -19,11 +19,31 @@ from distutils.command.build_ext import build_ext
|
|||
|
||||
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):
|
||||
warnings.warn(
|
||||
"Pillow does not yet support Python {}.{} and does not yet provide "
|
||||
"prebuilt Windows binaries. We do not recommend building from "
|
||||
"source on Windows.".format(sys.version_info.major, sys.version_info.minor),
|
||||
"Pillow {} does not support Python {}.{} and does not provide prebuilt "
|
||||
"Windows binaries. We do not recommend building from source on Windows.".format(
|
||||
PILLOW_VERSION, sys.version_info.major, sys.version_info.minor
|
||||
),
|
||||
RuntimeWarning,
|
||||
)
|
||||
|
||||
|
@ -228,24 +248,6 @@ def _read(file):
|
|||
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):
|
||||
try:
|
||||
command = os.environ.get("PKG_CONFIG", "pkg-config")
|
||||
|
@ -854,7 +856,12 @@ try:
|
|||
license="HPND",
|
||||
author="Alex Clark (PIL Fork Author)",
|
||||
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=[
|
||||
"Development Status :: 6 - Mature",
|
||||
"License :: OSI Approved :: Historical Permission Notice and Disclaimer (HPND)", # noqa: E501
|
||||
|
|
|
@ -155,7 +155,7 @@ class DdsImageFile(ImageFile.ImageFile):
|
|||
n = 7
|
||||
elif dxgi_format == DXGI_FORMAT_BC7_UNORM_SRGB:
|
||||
self.pixel_format = "BC7"
|
||||
self.im_info["gamma"] = 1 / 2.2
|
||||
self.info["gamma"] = 1 / 2.2
|
||||
n = 7
|
||||
else:
|
||||
raise NotImplementedError(
|
||||
|
|
|
@ -2231,6 +2231,7 @@ class Image:
|
|||
raise ValueError("missing method data")
|
||||
|
||||
im = new(self.mode, size, fillcolor)
|
||||
im.info = self.info.copy()
|
||||
if method == MESH:
|
||||
# list of quads
|
||||
for box, quad in data:
|
||||
|
|
|
@ -298,25 +298,21 @@ class IFDRational(Rational):
|
|||
float/rational/other number, or an IFDRational
|
||||
:param denominator: Optional integer denominator
|
||||
"""
|
||||
self._denominator = denominator
|
||||
self._numerator = value
|
||||
self._val = float(1)
|
||||
if isinstance(value, IFDRational):
|
||||
self._numerator = value.numerator
|
||||
self._denominator = value.denominator
|
||||
self._val = value._val
|
||||
return
|
||||
|
||||
if isinstance(value, Fraction):
|
||||
self._numerator = value.numerator
|
||||
self._denominator = value.denominator
|
||||
self._val = value
|
||||
|
||||
if isinstance(value, IFDRational):
|
||||
self._denominator = value.denominator
|
||||
self._numerator = value.numerator
|
||||
self._val = value._val
|
||||
return
|
||||
else:
|
||||
self._numerator = value
|
||||
self._denominator = denominator
|
||||
|
||||
if denominator == 0:
|
||||
self._val = float("nan")
|
||||
return
|
||||
|
||||
elif denominator == 1:
|
||||
self._val = Fraction(value)
|
||||
else:
|
||||
|
|
|
@ -627,8 +627,6 @@ ImagingResampleInner(Imaging imIn, int xsize, int ysize,
|
|||
if ( ! ksize_vert) {
|
||||
free(bounds_horiz);
|
||||
free(kk_horiz);
|
||||
free(bounds_vert);
|
||||
free(kk_vert);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ pythons = {
|
|||
"36": {"compiler": 7.1, "vc": 2015},
|
||||
"pypy3": {"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
|
||||
"3.5": {"compiler": 7.1, "vc": 2015},
|
||||
"3.6": {"compiler": 7.1, "vc": 2015},
|
||||
|
@ -34,9 +34,9 @@ libs = {
|
|||
"dir": "jpeg-9c",
|
||||
},
|
||||
"tiff": {
|
||||
"url": "ftp://download.osgeo.org/libtiff/tiff-4.0.10.tar.gz",
|
||||
"filename": "tiff-4.0.10.tar.gz",
|
||||
"dir": "tiff-4.0.10",
|
||||
"url": "ftp://download.osgeo.org/libtiff/tiff-4.1.0.tar.gz",
|
||||
"filename": "tiff-4.1.0.tar.gz",
|
||||
"dir": "tiff-4.1.0",
|
||||
},
|
||||
"freetype": {
|
||||
"url": "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.1.tar.gz", # noqa: E501
|
||||
|
|
9
winbuild/lcms2_patch.ps1
Normal file
9
winbuild/lcms2_patch.ps1
Normal 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"))
|
||||
}
|
Loading…
Reference in New Issue
Block a user