From 8aa5ec661fff4e1ed77c2ab294271f69e468e21b Mon Sep 17 00:00:00 2001 From: nulano Date: Mon, 23 Sep 2019 13:12:01 +0200 Subject: [PATCH 01/20] Create test-windows.yml --- .github/workflows/test-windows.yml | 32 ++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 .github/workflows/test-windows.yml diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml new file mode 100644 index 00000000000..7c8ca949ca0 --- /dev/null +++ b/.github/workflows/test-windows.yml @@ -0,0 +1,32 @@ +name: Test Windows + +on: [push, pull_request] + +jobs: + build: + + runs-on: windows-2016 + strategy: + matrix: + python-version: ["3.7"] + + name: Python ${{ matrix.python-version }} + + steps: + - uses: actions/checkout@v1 + + - name: Prepare dependencies + run: python.exe winbuild\build_dep.py + + - name: Build dependencies + run: winbuild\build_deps.cmd + + - name: Build + run: python.exe winbuild\build.py + + - name: Test + run: python.exe selftest.py --installed + + - name: After success + run: echo TODO + From a0f62fc3064a4aee14b1544bbbe639ecd14811e1 Mon Sep 17 00:00:00 2001 From: nulano Date: Mon, 23 Sep 2019 13:47:45 +0200 Subject: [PATCH 02/20] test-windows.yml bulid_dep nmake --- .github/workflows/test-windows.yml | 93 ++++++++++++++++++++++++++---- winbuild/config.py | 3 + 2 files changed, 86 insertions(+), 10 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 7c8ca949ca0..223758b679f 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -8,25 +8,98 @@ jobs: runs-on: windows-2016 strategy: matrix: - python-version: ["3.7"] + python-version: ["3.6.8"] - name: Python ${{ matrix.python-version }} + name: Python ${{ matrix.python-version }} x86 steps: - uses: actions/checkout@v1 - - name: Prepare dependencies - run: python.exe winbuild\build_dep.py - - - name: Build dependencies - run: winbuild\build_deps.cmd + - name: Fetch dependencies + run: | + 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 c:\pillow-depends\*.zip $env:GITHUB_WORKSPACE\winbuild\ + xcopy c:\pillow-depends\*.tar.gz $env:GITHUB_WORKSPACE\winbuild\ + xcopy /s c:\pillow-depends\test_images\* $env:GITHUB_WORKSPACE\tests\images\ + cd $env:GITHUB_WORKSPACE/winbuild/ + python.exe $env:GITHUB_WORKSPACE\winbuild\build_dep.py + # .\build_deps.cmd + env: + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ + EXECUTABLE: bin\python.exe + shell: pwsh + + - name: Build dependencies / libjpeg + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 + echo on + set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include;%INCLUDE% + set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 + set BUILD=%GITHUB_WORKSPACE%\winbuild\build + cd /D %BUILD%\jpeg-9c + nmake -nologo -f makefile.vc setup-vc6 + nmake -nologo -f makefile.vc clean + nmake -nologo -f makefile.vc nodebug=1 libjpeg.lib + copy /Y /B j*.h %INCLIB% + copy /Y /B *.lib %INCLIB% + + - name: Build dependencies / zlib + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 + echo on + set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include;%INCLUDE% + set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 + set BUILD=%GITHUB_WORKSPACE%\winbuild\build + cd /D %BUILD%\zlib-1.2.11 + nmake -nologo -f win32\Makefile.msc clean + nmake -nologo -f win32\Makefile.msc zlib.lib + copy /Y /B z*.h %INCLIB% + copy /Y /B *.lib %INCLIB% + copy /Y /B zlib.lib %INCLIB%\z.lib + + - name: Build dependencies / libtiff + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 + echo on + set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include;%INCLUDE% + set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 + set BUILD=%GITHUB_WORKSPACE%\winbuild\build + cd /D %BUILD%\tiff-4.0.10 + copy %GITHUB_WORKSPACE%\winbuild\nmake.opt nmake.opt + nmake -nologo -f makefile.vc clean + nmake -nologo -f makefile.vc lib + copy /Y /B libtiff\tiff*.h %INCLIB% + copy /Y /B libtiff\*.dll %INCLIB% + copy /Y /B libtiff\*.lib %INCLIB% + + - name: Build dependencies / webp + run: | + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 + echo on + set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include;%INCLUDE% + set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 + set BUILD=%GITHUB_WORKSPACE%\winbuild\build + cd /D %BUILD%\libwebp-1.0.3 + rmdir /S /Q output\release-static + nmake -nologo -f Makefile.vc CFG=release-static RTLIBCFG=static OBJDIR=output ARCH=x86 all + mkdir %INCLIB%\webp + copy /Y /B src\webp\*.h %INCLIB%\webp + copy /Y /B output\release-static\x86\lib\* %INCLIB% - name: Build - run: python.exe winbuild\build.py + run: '%PYTHON%\%EXECUTABLE% %GITHUB_WORKSPACE%\winbuild\build.py' + env: + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ + EXECUTABLE: python.exe - name: Test - run: python.exe selftest.py --installed + run: '%PYTHON%\%EXECUTABLE% %GITHUB_WORKSPACE%\selftest.py --installed' + env: + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ + EXECUTABLE: python.exe - name: After success - run: echo TODO + run: echo TODO 1>&2 diff --git a/winbuild/config.py b/winbuild/config.py index debfe95270b..ff775a92170 100644 --- a/winbuild/config.py +++ b/winbuild/config.py @@ -4,11 +4,14 @@ PILLOW_DEPENDS_DIR = "C:\\pillow-depends\\" pythons = { + # for AppVeyor "27": {"compiler": 7, "vc": 2010}, "pypy2": {"compiler": 7, "vc": 2010}, "35": {"compiler": 7.1, "vc": 2015}, "36": {"compiler": 7.1, "vc": 2015}, "37": {"compiler": 7.1, "vc": 2015}, + # for GitHub Actions + "3.6": {"compiler": 7.1, "vc": 2015}, } VIRT_BASE = "c:/vp/" From 09715955c8b0cdbae840886ab11d37791e3b7f2d Mon Sep 17 00:00:00 2001 From: nulano Date: Mon, 23 Sep 2019 22:01:19 +0200 Subject: [PATCH 03/20] test-windows.yml bulid --- .github/workflows/test-windows.yml | 40 +++++++++++++++++++----------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 223758b679f..3ee9fb4409f 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -33,12 +33,12 @@ jobs: - name: Build dependencies / libjpeg run: | - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 - echo on - set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include;%INCLUDE% + 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%\jpeg-9c + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 + echo on nmake -nologo -f makefile.vc setup-vc6 nmake -nologo -f makefile.vc clean nmake -nologo -f makefile.vc nodebug=1 libjpeg.lib @@ -47,12 +47,12 @@ jobs: - name: Build dependencies / zlib run: | - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 - echo on - set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include;%INCLUDE% + 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%\zlib-1.2.11 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 + echo on nmake -nologo -f win32\Makefile.msc clean nmake -nologo -f win32\Makefile.msc zlib.lib copy /Y /B z*.h %INCLIB% @@ -61,12 +61,12 @@ jobs: - name: Build dependencies / libtiff run: | - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 - echo on - set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include;%INCLUDE% + 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" x86 8.1 + echo on copy %GITHUB_WORKSPACE%\winbuild\nmake.opt nmake.opt nmake -nologo -f makefile.vc clean nmake -nologo -f makefile.vc lib @@ -76,25 +76,35 @@ jobs: - name: Build dependencies / webp run: | - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 - echo on - set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include;%INCLUDE% + 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%\libwebp-1.0.3 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 + echo on rmdir /S /Q output\release-static nmake -nologo -f Makefile.vc CFG=release-static RTLIBCFG=static OBJDIR=output ARCH=x86 all mkdir %INCLIB%\webp copy /Y /B src\webp\*.h %INCLIB%\webp copy /Y /B output\release-static\x86\lib\* %INCLIB% - - name: Build - run: '%PYTHON%\%EXECUTABLE% %GITHUB_WORKSPACE%\winbuild\build.py' + - name: Build Pillow + run: | + set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include + set MPLSRC=%GITHUB_WORKSPACE% + set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 + cd /D %GITHUB_WORKSPACE% + set DISTUTILS_USE_SDK=1 + 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" x86 8.1 + set BLDOPT=install + %PYTHON%\%EXECUTABLE% setup.py build_ext --add-imaging-libs=msvcrt install env: PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ EXECUTABLE: python.exe - - name: Test + - name: Test Pillow run: '%PYTHON%\%EXECUTABLE% %GITHUB_WORKSPACE%\selftest.py --installed' env: PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ From 339e3838a18dbf8b48897777b79f74174ac4df9c Mon Sep 17 00:00:00 2001 From: nulano Date: Mon, 23 Sep 2019 22:45:21 +0200 Subject: [PATCH 04/20] test-windows.yml test --- .github/workflows/test-windows.yml | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 3ee9fb4409f..ad807961cbc 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -100,16 +100,38 @@ jobs: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 set BLDOPT=install %PYTHON%\%EXECUTABLE% setup.py build_ext --add-imaging-libs=msvcrt install + %PYTHON%\%EXECUTABLE% selftest.py --installed env: PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ EXECUTABLE: python.exe + + - name: Install PyTest + run: '%PYTHON%\%PIP% install pytest pytest-cov' + env: + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ + PIP: Scripts\pip.exe - name: Test Pillow - run: '%PYTHON%\%EXECUTABLE% %GITHUB_WORKSPACE%\selftest.py --installed' + run: | + cd /D %GITHUB_WORKSPACE% + %PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests env: PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ EXECUTABLE: python.exe + + - name: Install Codecov + run: '%PYTHON%\%PIP% install codecov' + env: + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ + PIP: Scripts\pip.exe - - name: After success - run: echo TODO 1>&2 + - name: Upload coverage + run: | + cd /D %GITHUB_WORKSPACE% + codecov --file coverage.xml --name %PYTHON% + echo TODO upload coverage + exit /B 1 + env: + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ + EXECUTABLE: python.exe From a26a6e502840aa89c45d839bc1d06496321c4e23 Mon Sep 17 00:00:00 2001 From: nulano Date: Tue, 24 Sep 2019 08:41:30 +0200 Subject: [PATCH 05/20] test-windows.yml build_dep others, codecov --- .github/workflows/test-windows.yml | 100 +++++++++++++++++++++++------ winbuild/build.py | 2 +- 2 files changed, 83 insertions(+), 19 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index ad807961cbc..321940bd248 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -27,7 +27,7 @@ jobs: python.exe $env:GITHUB_WORKSPACE\winbuild\build_dep.py # .\build_deps.cmd env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86 EXECUTABLE: bin\python.exe shell: pwsh @@ -87,7 +87,78 @@ jobs: mkdir %INCLIB%\webp copy /Y /B src\webp\*.h %INCLIB%\webp copy /Y /B output\release-static\x86\lib\* %INCLIB% - + + - name: Build dependencies / freetype + run: | + REM Toolkit v100 not available; missing VCTargetsPath; Clean fails + + 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%\freetype-2.10.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 + 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" + %MSBUILD% builds\windows\vc2010\freetype.sln /t:Build /p:Configuration="Release" /p:Platform=Win32 /m + xcopy /Y /E /Q include %INCLIB% + copy /Y /B objs\Win32\Release\freetype.dll %INCLIB% + copy /Y /B objs\Win32\Release\freetype.lib %INCLIB% + + - name: Build dependencies / lcms2 + if: false + run: | + REM Projects\VC2015\lcms2.sln is not available in lcms2-2.7 + + 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%\lcms2-2.7 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 + 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" + %MSBUILD% Projects\VC2015\lcms2.sln /t:Clean;lcms2_static /p:Configuration="Release" /p:Platform=Win32 /m + xcopy /Y /E /Q include %INCLIB% + copy /Y /B Lib\MS\*.lib %INCLIB% + + - name: Build dependencies / openjpeg + 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%\openjpeg-2.3.1msvcr10-x32 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 + echo on + cmake.exe -DBUILD_THIRDPARTY:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" . + nmake -nologo -f Makefile clean + nmake -nologo -f Makefile + mkdir %INCLIB%\openjpeg-2.3.1 + copy /Y /B src\lib\openjp2\*.h %INCLIB%\openjpeg-2.3.1 + copy /Y /B bin\*.lib %INCLIB% + + - name: Build dependencies / ghostscript + if: false + run: | + REM only used for Python 2.7 in AppVeyor? + + 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" x86 8.1 + echo on + set MSVC_VERSION=14 + set RCOMP="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\RC.Exe" + nmake -nologo -f psi\msvc.mak + copy /Y /B bin\ %PYTHON% + env: + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86 + - name: Build Pillow run: | set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include @@ -100,15 +171,16 @@ jobs: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 set BLDOPT=install %PYTHON%\%EXECUTABLE% setup.py build_ext --add-imaging-libs=msvcrt install + %PYTHON%\%EXECUTABLE% -c "from PIL import _webp;import os, shutil;shutil.copy(r'%INCLIB%\freetype.dll', os.path.dirname(_webp.__file__));" %PYTHON%\%EXECUTABLE% selftest.py --installed env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86 EXECUTABLE: python.exe - - name: Install PyTest - run: '%PYTHON%\%PIP% install pytest pytest-cov' + - name: pip install pytest pytest-cov codecov + run: '%PYTHON%\%PIP% install pytest pytest-cov codecov' env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86 PIP: Scripts\pip.exe - name: Test Pillow @@ -116,22 +188,14 @@ jobs: cd /D %GITHUB_WORKSPACE% %PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86 EXECUTABLE: python.exe - - - name: Install Codecov - run: '%PYTHON%\%PIP% install codecov' - env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ - PIP: Scripts\pip.exe - name: Upload coverage run: | cd /D %GITHUB_WORKSPACE% - codecov --file coverage.xml --name %PYTHON% - echo TODO upload coverage - exit /B 1 + %PYTHON%\%CODECOV% --file coverage.xml --name %PYTHON% env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86\ - EXECUTABLE: python.exe + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86 + CODECOV: Scripts\codecov.exe diff --git a/winbuild/build.py b/winbuild/build.py index 0617022dcf9..e66df2f030c 100755 --- a/winbuild/build.py +++ b/winbuild/build.py @@ -127,7 +127,7 @@ def build_one(py_ver, compiler, bit): setlocal set LIB=%%LIB%%;C:\Python%(py_ver)s\tcl%(vc_setup)s call %(python_path)s\%(executable)s setup.py %(imaging_libs)s %%BLDOPT%% -call %(python_path)s\%(executable)s -c "from PIL import _webp;import os, shutil;shutil.copy('%%INCLIB%%\\freetype.dll', os.path.dirname(_webp.__file__));" +call %(python_path)s\%(executable)s -c "from PIL import _webp;import os, shutil;shutil.copy(r'%%INCLIB%%\freetype.dll', os.path.dirname(_webp.__file__));" endlocal endlocal From 1b59dd4f7980cb0abf4d012f449fd5c6ba4228f3 Mon Sep 17 00:00:00 2001 From: nulano Date: Tue, 24 Sep 2019 11:48:14 +0200 Subject: [PATCH 06/20] test-windows.yml build_dep ghostscript --- .github/workflows/test-windows.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 321940bd248..6ed500c83b8 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -142,10 +142,7 @@ jobs: copy /Y /B bin\*.lib %INCLIB% - name: Build dependencies / ghostscript - if: false run: | - REM only used for Python 2.7 in AppVeyor? - 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 @@ -155,7 +152,8 @@ jobs: set MSVC_VERSION=14 set RCOMP="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\RC.Exe" nmake -nologo -f psi\msvc.mak - copy /Y /B bin\ %PYTHON% + rem Add bin to PATH variable: Copy to INCLIB, then add INCLIB to PATH in Test step. + copy /Y /B bin\* %INCLIB% env: PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86 @@ -185,6 +183,9 @@ jobs: - name: Test Pillow run: | + set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 + rem Add GhostScript executables (copied to INCLIB) to PATH. + path %INCLIB%;%PATH% cd /D %GITHUB_WORKSPACE% %PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests env: From df1e290d88751857c264bb440cab3f14785b5c6d Mon Sep 17 00:00:00 2001 From: nulano Date: Tue, 24 Sep 2019 12:59:44 +0200 Subject: [PATCH 07/20] test-windows.yml matrix python-version --- .github/workflows/test-windows.yml | 2 +- winbuild/config.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 6ed500c83b8..2669d42fda7 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -8,7 +8,7 @@ jobs: runs-on: windows-2016 strategy: matrix: - python-version: ["3.6.8"] + python-version: ["3.5.4", "3.6.8", "3.7.4"] name: Python ${{ matrix.python-version }} x86 diff --git a/winbuild/config.py b/winbuild/config.py index ff775a92170..77be977696b 100644 --- a/winbuild/config.py +++ b/winbuild/config.py @@ -11,7 +11,9 @@ "36": {"compiler": 7.1, "vc": 2015}, "37": {"compiler": 7.1, "vc": 2015}, # for GitHub Actions + "3.5": {"compiler": 7.1, "vc": 2015}, "3.6": {"compiler": 7.1, "vc": 2015}, + "3.7": {"compiler": 7.1, "vc": 2015}, } VIRT_BASE = "c:/vp/" From 74a7fd598549ced7e54ff11f66e5cd328970c3c6 Mon Sep 17 00:00:00 2001 From: nulano Date: Tue, 24 Sep 2019 13:33:52 +0200 Subject: [PATCH 08/20] test-windows.yml matrix platform --- .github/workflows/test-windows.yml | 57 +++++++++++++++++------------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 2669d42fda7..4a2b79cfd23 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -8,9 +8,19 @@ jobs: runs-on: windows-2016 strategy: matrix: - python-version: ["3.5.4", "3.6.8", "3.7.4"] + python-version: + - "3.5.4" + - "3.6.8" + - "3.7.4" + platform: + - name: "x86" + vars: "x86" + msbuild: "Win32" + - name: "x64" + vars: "x86_amd64" + msbuild: "x64" - name: Python ${{ matrix.python-version }} x86 + name: Python ${{ matrix.python-version }} ${{ matrix.platform.name }} steps: - uses: actions/checkout@v1 @@ -27,7 +37,7 @@ jobs: python.exe $env:GITHUB_WORKSPACE\winbuild\build_dep.py # .\build_deps.cmd env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86 + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\${{ matrix.platform.name }} EXECUTABLE: bin\python.exe shell: pwsh @@ -37,7 +47,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" x86 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1 echo on nmake -nologo -f makefile.vc setup-vc6 nmake -nologo -f makefile.vc clean @@ -51,7 +61,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" x86 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1 echo on nmake -nologo -f win32\Makefile.msc clean nmake -nologo -f win32\Makefile.msc zlib.lib @@ -65,7 +75,7 @@ jobs: 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" x86 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1 echo on copy %GITHUB_WORKSPACE%\winbuild\nmake.opt nmake.opt nmake -nologo -f makefile.vc clean @@ -80,13 +90,13 @@ 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" x86 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1 echo on rmdir /S /Q output\release-static - nmake -nologo -f Makefile.vc CFG=release-static RTLIBCFG=static OBJDIR=output ARCH=x86 all + nmake -nologo -f Makefile.vc CFG=release-static RTLIBCFG=static OBJDIR=output ARCH=${{ matrix.platform.name }} all mkdir %INCLIB%\webp copy /Y /B src\webp\*.h %INCLIB%\webp - copy /Y /B output\release-static\x86\lib\* %INCLIB% + copy /Y /B output\release-static\${{ matrix.platform.name }}\lib\* %INCLIB% - name: Build dependencies / freetype run: | @@ -96,16 +106,16 @@ 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" x86 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1 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" - %MSBUILD% builds\windows\vc2010\freetype.sln /t:Build /p:Configuration="Release" /p:Platform=Win32 /m + %MSBUILD% builds\windows\vc2010\freetype.sln /t:Build /p:Configuration="Release" /p:Platform=${{ matrix.platform.msbuild }} /m xcopy /Y /E /Q include %INCLIB% - copy /Y /B objs\Win32\Release\freetype.dll %INCLIB% - copy /Y /B objs\Win32\Release\freetype.lib %INCLIB% + copy /Y /B objs\${{ matrix.platform.msbuild }}\Release\freetype.dll %INCLIB% + copy /Y /B objs\${{ matrix.platform.msbuild }}\Release\freetype.lib %INCLIB% - name: Build dependencies / lcms2 if: false @@ -116,13 +126,13 @@ jobs: set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 set BUILD=%GITHUB_WORKSPACE%\winbuild\build cd /D %BUILD%\lcms2-2.7 - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" x86 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1 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" - %MSBUILD% Projects\VC2015\lcms2.sln /t:Clean;lcms2_static /p:Configuration="Release" /p:Platform=Win32 /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% copy /Y /B Lib\MS\*.lib %INCLIB% @@ -132,7 +142,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" x86 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1 echo on cmake.exe -DBUILD_THIRDPARTY:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" . nmake -nologo -f Makefile clean @@ -147,15 +157,14 @@ jobs: 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" x86 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1 echo on set MSVC_VERSION=14 set RCOMP="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\RC.Exe" + if "${{ matrix.platform.name }}"=="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% - env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86 - name: Build Pillow run: | @@ -166,19 +175,19 @@ jobs: set DISTUTILS_USE_SDK=1 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" x86 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1 set BLDOPT=install %PYTHON%\%EXECUTABLE% setup.py build_ext --add-imaging-libs=msvcrt install %PYTHON%\%EXECUTABLE% -c "from PIL import _webp;import os, shutil;shutil.copy(r'%INCLIB%\freetype.dll', os.path.dirname(_webp.__file__));" %PYTHON%\%EXECUTABLE% selftest.py --installed env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86 + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\${{ matrix.platform.name }} EXECUTABLE: python.exe - name: pip install pytest pytest-cov codecov run: '%PYTHON%\%PIP% install pytest pytest-cov codecov' env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86 + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\${{ matrix.platform.name }} PIP: Scripts\pip.exe - name: Test Pillow @@ -189,7 +198,7 @@ jobs: cd /D %GITHUB_WORKSPACE% %PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86 + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\${{ matrix.platform.name }} EXECUTABLE: python.exe - name: Upload coverage @@ -197,6 +206,6 @@ jobs: cd /D %GITHUB_WORKSPACE% %PYTHON%\%CODECOV% --file coverage.xml --name %PYTHON% env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\x86 + PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\${{ matrix.platform.name }} CODECOV: Scripts\codecov.exe From 4d35cb9d0a4514ff62464dc0abcee5effa3d240d Mon Sep 17 00:00:00 2001 From: nulano Date: Tue, 24 Sep 2019 18:15:31 +0200 Subject: [PATCH 09/20] test-windows.yml pypy3, use actions/setup-python --- .github/workflows/test-windows.yml | 108 ++++++++++++++++++----------- Tests/helper.py | 9 ++- Tests/test_image_access.py | 6 +- Tests/test_imageshow.py | 9 ++- Tests/test_main.py | 8 +++ 5 files changed, 92 insertions(+), 48 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 4a2b79cfd23..d7b30370232 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -7,26 +7,57 @@ jobs: runs-on: windows-2016 strategy: + fail-fast: false matrix: - python-version: - - "3.5.4" - - "3.6.8" - - "3.7.4" - platform: - - name: "x86" - vars: "x86" - msbuild: "Win32" - - name: "x64" - vars: "x86_amd64" - msbuild: "x64" + python-version: ["3.5", "3.6", "3.7", "pypy3.6"] + architecture: ["x86", "x64"] + include: + - architecture: "x86" + platform-vcvars: "x86" + platform-msbuild: "Win32" + - architecture: "x64" + platform-vcvars: "x86_amd64" + platform-msbuild: "x64" + - python-version: "pypy3.6" + pypy-version: "pypy-c-jit-97588-7392d01b93d0-win32" + pypy-url: "http://buildbot.pypy.org/nightly/py3.6/pypy-c-jit-97588-7392d01b93d0-win32.zip" + # pypy-url: "https://bitbucket.org/pypy/pypy/downloads/${{ matrix.pypy-version }}.zip" + exclude: + - python-version: "pypy3.6" + architecture: "x64" + timeout-minutes: 30 - name: Python ${{ matrix.python-version }} ${{ matrix.platform.name }} + name: Python ${{ matrix.python-version }} ${{ matrix.architecture }} steps: - uses: actions/checkout@v1 + + - name: Install PyPy + if: "contains(matrix.python-version, 'pypy')" + run: | + curl -fsSL -o pypy3.zip "${{ matrix.pypy-url }}" + 7z x pypy3.zip "-o$env:RUNNER_WORKSPACE\" + mv "$env:RUNNER_WORKSPACE\${{ matrix.pypy-version }}" "$env:RUNNER_WORKSPACE\${{ matrix.python-version }}" + $env:PYTHON="$env:RUNNER_WORKSPACE\${{ matrix.python-version }}" + # set env: pythonLocation + Write-Host "`#`#[set-env name=pythonLocation;]$env:PYTHON" # old syntax https://github.com/actions/toolkit/issues/61 + 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:PYTHON\python.exe get-pip.py + shell: pwsh + + # sets env: pythonLocation + - name: Set up Python + if: "!contains(matrix.python-version, 'pypy')" + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + architecture: ${{ matrix.architecture }} - name: Fetch dependencies run: | + $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:\ mv c:\pillow-depends-master c:\pillow-depends @@ -37,7 +68,6 @@ jobs: python.exe $env:GITHUB_WORKSPACE\winbuild\build_dep.py # .\build_deps.cmd env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\${{ matrix.platform.name }} EXECUTABLE: bin\python.exe shell: pwsh @@ -47,7 +77,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.vars }} 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 echo on nmake -nologo -f makefile.vc setup-vc6 nmake -nologo -f makefile.vc clean @@ -61,7 +91,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.vars }} 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 echo on nmake -nologo -f win32\Makefile.msc clean nmake -nologo -f win32\Makefile.msc zlib.lib @@ -75,7 +105,7 @@ jobs: 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.vars }} 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 echo on copy %GITHUB_WORKSPACE%\winbuild\nmake.opt nmake.opt nmake -nologo -f makefile.vc clean @@ -90,13 +120,13 @@ 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.vars }} 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 echo on rmdir /S /Q output\release-static - nmake -nologo -f Makefile.vc CFG=release-static RTLIBCFG=static OBJDIR=output ARCH=${{ matrix.platform.name }} all + nmake -nologo -f Makefile.vc CFG=release-static RTLIBCFG=static OBJDIR=output ARCH=${{ matrix.architecture }} all mkdir %INCLIB%\webp copy /Y /B src\webp\*.h %INCLIB%\webp - copy /Y /B output\release-static\${{ matrix.platform.name }}\lib\* %INCLIB% + copy /Y /B output\release-static\${{ matrix.architecture }}\lib\* %INCLIB% - name: Build dependencies / freetype run: | @@ -106,16 +136,16 @@ 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.vars }} 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 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" - %MSBUILD% builds\windows\vc2010\freetype.sln /t:Build /p:Configuration="Release" /p:Platform=${{ matrix.platform.msbuild }} /m + %MSBUILD% builds\windows\vc2010\freetype.sln /t:Build /p:Configuration="Release" /p:Platform=${{ matrix.platform-msbuild }} /m xcopy /Y /E /Q include %INCLIB% - copy /Y /B objs\${{ matrix.platform.msbuild }}\Release\freetype.dll %INCLIB% - copy /Y /B objs\${{ matrix.platform.msbuild }}\Release\freetype.lib %INCLIB% + copy /Y /B objs\${{ matrix.platform-msbuild }}\Release\freetype.dll %INCLIB% + copy /Y /B objs\${{ matrix.platform-msbuild }}\Release\freetype.lib %INCLIB% - name: Build dependencies / lcms2 if: false @@ -126,13 +156,13 @@ jobs: set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 set BUILD=%GITHUB_WORKSPACE%\winbuild\build cd /D %BUILD%\lcms2-2.7 - call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform.vars }} 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 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" - %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% copy /Y /B Lib\MS\*.lib %INCLIB% @@ -142,7 +172,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.vars }} 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 echo on cmake.exe -DBUILD_THIRDPARTY:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" . nmake -nologo -f Makefile clean @@ -157,17 +187,18 @@ jobs: 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.vars }} 8.1 + 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.platform.name }}"=="x64" set WIN64="" + 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% - name: Build Pillow run: | + set PYTHON=%pythonLocation% set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include set MPLSRC=%GITHUB_WORKSPACE% set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 @@ -175,37 +206,30 @@ jobs: set DISTUTILS_USE_SDK=1 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.vars }} 8.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 set BLDOPT=install %PYTHON%\%EXECUTABLE% setup.py build_ext --add-imaging-libs=msvcrt install %PYTHON%\%EXECUTABLE% -c "from PIL import _webp;import os, shutil;shutil.copy(r'%INCLIB%\freetype.dll', os.path.dirname(_webp.__file__));" %PYTHON%\%EXECUTABLE% selftest.py --installed env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\${{ matrix.platform.name }} EXECUTABLE: python.exe - name: pip install pytest pytest-cov codecov - run: '%PYTHON%\%PIP% install pytest pytest-cov codecov' - env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\${{ matrix.platform.name }} - PIP: Scripts\pip.exe + run: | + "%pythonLocation%\python.exe" -m pip install pytest pytest-cov + pip install codecov - name: Test Pillow run: | + set PYTHON=%pythonLocation% set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 rem Add GhostScript executables (copied to INCLIB) to PATH. path %INCLIB%;%PATH% cd /D %GITHUB_WORKSPACE% - %PYTHON%\%EXECUTABLE% -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests - env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\${{ matrix.platform.name }} - EXECUTABLE: python.exe + %PYTHON%\python.exe -m pytest -vx --cov PIL --cov-report term --cov-report xml Tests - name: Upload coverage - run: | - cd /D %GITHUB_WORKSPACE% - %PYTHON%\%CODECOV% --file coverage.xml --name %PYTHON% + run: 'codecov --file "%GITHUB_WORKSPACE%\coverage.xml" --name "%pythonLocation%"' env: - PYTHON: C:\hostedtoolcache\windows\Python\${{ matrix.python-version }}\${{ matrix.platform.name }} CODECOV: Scripts\codecov.exe diff --git a/Tests/helper.py b/Tests/helper.py index 78a2f520f92..c352f54b940 100644 --- a/Tests/helper.py +++ b/Tests/helper.py @@ -355,10 +355,17 @@ def on_appveyor(): return "APPVEYOR" in os.environ +def on_github_actions(): + return "GITHUB_ACTIONS" in os.environ + + def on_ci(): # Travis and AppVeyor have "CI" # Azure Pipelines has "TF_BUILD" - return "CI" in os.environ or "TF_BUILD" in os.environ + # GitHub Actions has "GITHUB_ACTIONS" + return ( + "CI" in os.environ or "TF_BUILD" in os.environ or "GITHUB_ACTIONS" in os.environ + ) if sys.platform == "win32": diff --git a/Tests/test_image_access.py b/Tests/test_image_access.py index b06814cb944..b69c2040f4c 100644 --- a/Tests/test_image_access.py +++ b/Tests/test_image_access.py @@ -3,7 +3,7 @@ from PIL import Image -from .helper import PillowTestCase, hopper, on_appveyor, unittest +from .helper import PillowTestCase, hopper, on_ci, unittest # CFFI imports pycparser which doesn't support PYTHONOPTIMIZE=2 # https://github.com/eliben/pycparser/pull/198#issuecomment-317001670 @@ -333,8 +333,8 @@ def test_p_putpixel_rgb_rgba(self): class TestEmbeddable(unittest.TestCase): @unittest.skipIf( - not sys.platform.startswith("win32") or on_appveyor(), - "Failing on AppVeyor when run from subprocess, not from shell", + not sys.platform.startswith("win32") or on_ci(), + "Failing on AppVeyor / GitHub Actions when run from subprocess, not from shell", ) def test_embeddable(self): import subprocess diff --git a/Tests/test_imageshow.py b/Tests/test_imageshow.py index 2f2620b7408..bad0329af44 100644 --- a/Tests/test_imageshow.py +++ b/Tests/test_imageshow.py @@ -1,6 +1,8 @@ +import sys + from PIL import Image, ImageShow -from .helper import PillowTestCase, hopper, on_ci, unittest +from .helper import PillowTestCase, hopper, on_ci, on_github_actions, unittest class TestImageShow(PillowTestCase): @@ -34,7 +36,10 @@ def show_image(self, image, **options): # Restore original state ImageShow._viewers.pop(0) - @unittest.skipUnless(on_ci(), "Only run on CIs") + @unittest.skipUnless( + on_ci() and not (sys.platform == "win32" and on_github_actions()), + "Only run on CIs; hangs on Windows on Github Actions", + ) def test_show(self): for mode in ("1", "I;16", "LA", "RGB", "RGBA"): im = hopper(mode) diff --git a/Tests/test_main.py b/Tests/test_main.py index 847def83423..936a938f95b 100644 --- a/Tests/test_main.py +++ b/Tests/test_main.py @@ -5,8 +5,16 @@ import sys from unittest import TestCase +from .helper import on_github_actions, unittest + class TestMain(TestCase): + @unittest.skipIf( + sys.platform == "win32" + and hasattr(sys, "pypy_translation_info") + and on_github_actions(), + "Failing on Windows on GitHub Actions running PyPy", + ) def test_main(self): out = subprocess.check_output([sys.executable, "-m", "PIL"]).decode("utf-8") lines = out.splitlines() From e1d3437644eebcdb0389510880642b3646967e5b Mon Sep 17 00:00:00 2001 From: nulano Date: Wed, 25 Sep 2019 09:58:29 +0200 Subject: [PATCH 10/20] test-windows.yml upload-artifact --- .github/workflows/test-windows.yml | 43 +++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 12 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index d7b30370232..7d0f0656aae 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -54,6 +54,11 @@ jobs: with: python-version: ${{ matrix.python-version }} architecture: ${{ matrix.architecture }} + + - name: pip install wheel pytest pytest-cov codecov + run: | + "%pythonLocation%\python.exe" -m pip install wheel pytest pytest-cov + pip install codecov - name: Fetch dependencies run: | @@ -207,17 +212,9 @@ jobs: 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 - set BLDOPT=install - %PYTHON%\%EXECUTABLE% setup.py build_ext --add-imaging-libs=msvcrt install - %PYTHON%\%EXECUTABLE% -c "from PIL import _webp;import os, shutil;shutil.copy(r'%INCLIB%\freetype.dll', os.path.dirname(_webp.__file__));" - %PYTHON%\%EXECUTABLE% selftest.py --installed - env: - EXECUTABLE: python.exe - - - name: pip install pytest pytest-cov codecov - run: | - "%pythonLocation%\python.exe" -m pip install pytest pytest-cov - pip install codecov + %PYTHON%\python.exe setup.py build_ext --add-imaging-libs=msvcrt install + %PYTHON%\python.exe -c "from PIL import _webp;import os, shutil;shutil.copy(r'%INCLIB%\freetype.dll', os.path.dirname(_webp.__file__));" + %PYTHON%\python.exe selftest.py --installed - name: Test Pillow run: | @@ -232,4 +229,26 @@ jobs: run: 'codecov --file "%GITHUB_WORKSPACE%\coverage.xml" --name "%pythonLocation%"' env: CODECOV: Scripts\codecov.exe - + + - name: Build wheel + id: wheel + if: "github.event_name == 'push' && !contains(matrix.python-version, 'pypy')" + run: | + for /f "tokens=3 delims=/" %%a in ("${{ github.ref }}") do echo ##[set-output name=dist;]dist-%%a + for /f "tokens=3 delims=/" %%a in ("${{ github.ref }}") do echo ::set-output name=dist::dist-%%a + set PYTHON=%pythonLocation% + set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include + set MPLSRC=%GITHUB_WORKSPACE% + set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 + cd /D %GITHUB_WORKSPACE% + set DISTUTILS_USE_SDK=1 + 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 + %PYTHON%\python.exe setup.py build_ext --add-imaging-libs=msvcrt bdist_wheel + + - uses: actions/upload-artifact@v1 + if: "github.event_name == 'push' && !contains(matrix.python-version, 'pypy')" + with: + name: ${{ steps.wheel.outputs.dist }} + path: dist From 113a72633aa6a7bec710a215313c6796424ef891 Mon Sep 17 00:00:00 2001 From: nulano Date: Wed, 25 Sep 2019 11:28:52 +0200 Subject: [PATCH 11/20] test-windows.yml clean names --- .github/workflows/test-windows.yml | 10 +++++----- Tests/test_imageshow.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 7d0f0656aae..33123b17839 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -104,7 +104,7 @@ jobs: copy /Y /B *.lib %INCLIB% copy /Y /B zlib.lib %INCLIB%\z.lib - - name: Build dependencies / libtiff + - name: Build dependencies / LibTIFF run: | set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 @@ -119,7 +119,7 @@ jobs: copy /Y /B libtiff\*.dll %INCLIB% copy /Y /B libtiff\*.lib %INCLIB% - - name: Build dependencies / webp + - name: Build dependencies / WebP run: | set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 @@ -133,7 +133,7 @@ jobs: copy /Y /B src\webp\*.h %INCLIB%\webp copy /Y /B output\release-static\${{ matrix.architecture }}\lib\* %INCLIB% - - name: Build dependencies / freetype + - name: Build dependencies / FreeType run: | REM Toolkit v100 not available; missing VCTargetsPath; Clean fails @@ -152,7 +152,7 @@ jobs: copy /Y /B objs\${{ matrix.platform-msbuild }}\Release\freetype.dll %INCLIB% copy /Y /B objs\${{ matrix.platform-msbuild }}\Release\freetype.lib %INCLIB% - - name: Build dependencies / lcms2 + - name: Build dependencies / LCMS2 if: false run: | REM Projects\VC2015\lcms2.sln is not available in lcms2-2.7 @@ -171,7 +171,7 @@ jobs: xcopy /Y /E /Q include %INCLIB% copy /Y /B Lib\MS\*.lib %INCLIB% - - name: Build dependencies / openjpeg + - name: Build dependencies / OpenJPEG run: | set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 diff --git a/Tests/test_imageshow.py b/Tests/test_imageshow.py index bad0329af44..1c756da9f7b 100644 --- a/Tests/test_imageshow.py +++ b/Tests/test_imageshow.py @@ -38,7 +38,7 @@ def show_image(self, image, **options): @unittest.skipUnless( on_ci() and not (sys.platform == "win32" and on_github_actions()), - "Only run on CIs; hangs on Windows on Github Actions", + "Only run on CIs; hangs on Windows on GitHub Actions", ) def test_show(self): for mode in ("1", "I;16", "LA", "RGB", "RGBA"): From cf1f8b04985233816a6971dcdd3831bb5afa46c1 Mon Sep 17 00:00:00 2001 From: nulano Date: Wed, 25 Sep 2019 11:46:54 +0200 Subject: [PATCH 12/20] Tests.helper cleanup --- Tests/check_imaging_leaks.py | 6 ++---- Tests/check_j2k_leaks.py | 5 ++--- Tests/check_jpeg_leaks.py | 5 ++--- Tests/helper.py | 8 ++++++++ Tests/test_core_resources.py | 12 +++++------- Tests/test_file_jpeg.py | 12 +++++++++--- Tests/test_file_png.py | 5 ++--- Tests/test_file_tiff.py | 5 ++--- Tests/test_font_leaks.py | 6 ++---- Tests/test_image.py | 7 ++----- Tests/test_image_access.py | 4 ++-- Tests/test_imagefont.py | 11 ++++------- Tests/test_imageshow.py | 6 ++---- Tests/test_imagewin.py | 6 ++---- Tests/test_imagewin_pointers.py | 5 ++--- Tests/test_main.py | 6 ++---- Tests/test_map.py | 4 ++-- Tests/test_shell_injection.py | 4 ++-- 18 files changed, 54 insertions(+), 63 deletions(-) diff --git a/Tests/check_imaging_leaks.py b/Tests/check_imaging_leaks.py index 2b9a9605be4..a109b5cd59b 100755 --- a/Tests/check_imaging_leaks.py +++ b/Tests/check_imaging_leaks.py @@ -2,17 +2,15 @@ from __future__ import division -import sys - from PIL import Image -from .helper import PillowTestCase, unittest +from .helper import PillowTestCase, is_win32, unittest min_iterations = 100 max_iterations = 10000 -@unittest.skipIf(sys.platform.startswith("win32"), "requires Unix or macOS") +@unittest.skipIf(is_win32(), "requires Unix or macOS") class TestImagingLeaks(PillowTestCase): def _get_mem_usage(self): from resource import getpagesize, getrusage, RUSAGE_SELF diff --git a/Tests/check_j2k_leaks.py b/Tests/check_j2k_leaks.py index 4614529ed11..d9c6c68b7a9 100755 --- a/Tests/check_j2k_leaks.py +++ b/Tests/check_j2k_leaks.py @@ -1,9 +1,8 @@ -import sys from io import BytesIO from PIL import Image -from .helper import PillowTestCase, unittest +from .helper import PillowTestCase, is_win32, unittest # Limits for testing the leak mem_limit = 1024 * 1048576 @@ -13,7 +12,7 @@ test_file = "Tests/images/rgb_trns_ycbc.jp2" -@unittest.skipIf(sys.platform.startswith("win32"), "requires Unix or macOS") +@unittest.skipIf(is_win32(), "requires Unix or macOS") class TestJpegLeaks(PillowTestCase): def setUp(self): if "jpeg2k_encoder" not in codecs or "jpeg2k_decoder" not in codecs: diff --git a/Tests/check_jpeg_leaks.py b/Tests/check_jpeg_leaks.py index 2f758ba10c1..8cb93f2dd0a 100644 --- a/Tests/check_jpeg_leaks.py +++ b/Tests/check_jpeg_leaks.py @@ -1,7 +1,6 @@ -import sys from io import BytesIO -from .helper import PillowTestCase, hopper, unittest +from .helper import PillowTestCase, hopper, is_win32, unittest iterations = 5000 @@ -15,7 +14,7 @@ """ -@unittest.skipIf(sys.platform.startswith("win32"), "requires Unix or macOS") +@unittest.skipIf(is_win32(), "requires Unix or macOS") class TestJpegLeaks(PillowTestCase): """ diff --git a/Tests/helper.py b/Tests/helper.py index c352f54b940..312c6aa4e54 100644 --- a/Tests/helper.py +++ b/Tests/helper.py @@ -368,6 +368,14 @@ def on_ci(): ) +def is_win32(): + return sys.platform.startswith("win32") + + +def is_pypy(): + return hasattr(sys, "pypy_translation_info") + + if sys.platform == "win32": IMCONVERT = os.environ.get("MAGICK_HOME", "") if IMCONVERT: diff --git a/Tests/test_core_resources.py b/Tests/test_core_resources.py index eefb1a0efab..0aedb91c926 100644 --- a/Tests/test_core_resources.py +++ b/Tests/test_core_resources.py @@ -4,9 +4,7 @@ from PIL import Image -from .helper import PillowTestCase, unittest - -is_pypy = hasattr(sys, "pypy_version_info") +from .helper import PillowTestCase, is_pypy, unittest class TestCoreStats(PillowTestCase): @@ -87,7 +85,7 @@ def test_set_block_size_stats(self): stats = Image.core.get_stats() self.assertGreaterEqual(stats["new_count"], 1) self.assertGreaterEqual(stats["allocated_blocks"], 64) - if not is_pypy: + if not is_pypy(): self.assertGreaterEqual(stats["freed_blocks"], 64) def test_get_blocks_max(self): @@ -108,7 +106,7 @@ def test_set_blocks_max(self): if sys.maxsize < 2 ** 32: self.assertRaises(ValueError, Image.core.set_blocks_max, 2 ** 29) - @unittest.skipIf(is_pypy, "images are not collected") + @unittest.skipIf(is_pypy(), "images are not collected") def test_set_blocks_max_stats(self): Image.core.reset_stats() Image.core.set_blocks_max(128) @@ -123,7 +121,7 @@ def test_set_blocks_max_stats(self): self.assertEqual(stats["freed_blocks"], 0) self.assertEqual(stats["blocks_cached"], 64) - @unittest.skipIf(is_pypy, "images are not collected") + @unittest.skipIf(is_pypy(), "images are not collected") def test_clear_cache_stats(self): Image.core.reset_stats() Image.core.clear_cache() @@ -153,7 +151,7 @@ def test_large_images(self): self.assertGreaterEqual(stats["allocated_blocks"], 16) self.assertGreaterEqual(stats["reused_blocks"], 0) self.assertEqual(stats["blocks_cached"], 0) - if not is_pypy: + if not is_pypy(): self.assertGreaterEqual(stats["freed_blocks"], 16) diff --git a/Tests/test_file_jpeg.py b/Tests/test_file_jpeg.py index 7f9bf7c1d6d..5a34a3faa74 100644 --- a/Tests/test_file_jpeg.py +++ b/Tests/test_file_jpeg.py @@ -1,10 +1,16 @@ import os -import sys from io import BytesIO from PIL import Image, ImageFile, JpegImagePlugin -from .helper import PillowTestCase, cjpeg_available, djpeg_available, hopper, unittest +from .helper import ( + PillowTestCase, + cjpeg_available, + djpeg_available, + hopper, + is_win32, + unittest, +) codecs = dir(Image.core) @@ -654,7 +660,7 @@ def test_photoshop(self): self.assertNotIn("photoshop", im.info) -@unittest.skipUnless(sys.platform.startswith("win32"), "Windows only") +@unittest.skipUnless(is_win32(), "Windows only") class TestFileCloseW32(PillowTestCase): def setUp(self): if "jpeg_encoder" not in codecs or "jpeg_decoder" not in codecs: diff --git a/Tests/test_file_png.py b/Tests/test_file_png.py index 6d76a6caa7c..07e84ef722b 100644 --- a/Tests/test_file_png.py +++ b/Tests/test_file_png.py @@ -1,11 +1,10 @@ -import sys import zlib from io import BytesIO from PIL import Image, ImageFile, PngImagePlugin from PIL._util import py3 -from .helper import PillowLeakTestCase, PillowTestCase, hopper, unittest +from .helper import PillowLeakTestCase, PillowTestCase, hopper, is_win32, unittest try: from PIL import _webp @@ -650,7 +649,7 @@ def test_apng(self): self.assert_image_similar(im, expected, 0.23) -@unittest.skipIf(sys.platform.startswith("win32"), "requires Unix or macOS") +@unittest.skipIf(is_win32(), "requires Unix or macOS") class TestTruncatedPngPLeaks(PillowLeakTestCase): mem_limit = 2 * 1024 # max increase in K iterations = 100 # Leak is 56k/iteration, this will leak 5.6megs diff --git a/Tests/test_file_tiff.py b/Tests/test_file_tiff.py index c3f55150c63..c8a4c2df3e7 100644 --- a/Tests/test_file_tiff.py +++ b/Tests/test_file_tiff.py @@ -1,12 +1,11 @@ import logging -import sys from io import BytesIO from PIL import Image, TiffImagePlugin, features from PIL._util import py3 from PIL.TiffImagePlugin import RESOLUTION_UNIT, X_RESOLUTION, Y_RESOLUTION -from .helper import PillowTestCase, hopper, unittest +from .helper import PillowTestCase, hopper, is_win32, unittest logger = logging.getLogger(__name__) @@ -612,7 +611,7 @@ def test_sampleformat_not_corrupted(self): im.load() -@unittest.skipUnless(sys.platform.startswith("win32"), "Windows only") +@unittest.skipUnless(is_win32(), "Windows only") class TestFileTiffW32(PillowTestCase): def test_fd_leak(self): tmpfile = self.tempfile("temp.tif") diff --git a/Tests/test_font_leaks.py b/Tests/test_font_leaks.py index 14b36858523..9b5fe2055d4 100644 --- a/Tests/test_font_leaks.py +++ b/Tests/test_font_leaks.py @@ -1,13 +1,11 @@ from __future__ import division -import sys - from PIL import Image, ImageDraw, ImageFont, features -from .helper import PillowLeakTestCase, unittest +from .helper import PillowLeakTestCase, is_win32, unittest -@unittest.skipIf(sys.platform.startswith("win32"), "requires Unix or macOS") +@unittest.skipIf(is_win32(), "requires Unix or macOS") class TestTTypeFontLeak(PillowLeakTestCase): # fails at iteration 3 in master iterations = 10 diff --git a/Tests/test_image.py b/Tests/test_image.py index 493b4735acd..cbf52b3b4df 100644 --- a/Tests/test_image.py +++ b/Tests/test_image.py @@ -1,11 +1,10 @@ import os import shutil -import sys from PIL import Image from PIL._util import py3 -from .helper import PillowTestCase, hopper, unittest +from .helper import PillowTestCase, hopper, is_win32, unittest class TestImage(PillowTestCase): @@ -150,9 +149,7 @@ def test_internals(self): im.paste(0, (0, 0, 100, 100)) self.assertFalse(im.readonly) - @unittest.skipIf( - sys.platform.startswith("win32"), "Test requires opening tempfile twice" - ) + @unittest.skipIf(is_win32(), "Test requires opening tempfile twice") def test_readonly_save(self): temp_file = self.tempfile("temp.bmp") shutil.copy("Tests/images/rgb32bf-rgba.bmp", temp_file) diff --git a/Tests/test_image_access.py b/Tests/test_image_access.py index b69c2040f4c..577df3dffa3 100644 --- a/Tests/test_image_access.py +++ b/Tests/test_image_access.py @@ -3,7 +3,7 @@ from PIL import Image -from .helper import PillowTestCase, hopper, on_ci, unittest +from .helper import PillowTestCase, hopper, is_win32, on_ci, unittest # CFFI imports pycparser which doesn't support PYTHONOPTIMIZE=2 # https://github.com/eliben/pycparser/pull/198#issuecomment-317001670 @@ -333,7 +333,7 @@ def test_p_putpixel_rgb_rgba(self): class TestEmbeddable(unittest.TestCase): @unittest.skipIf( - not sys.platform.startswith("win32") or on_ci(), + not is_win32() or on_ci(), "Failing on AppVeyor / GitHub Actions when run from subprocess, not from shell", ) def test_embeddable(self): diff --git a/Tests/test_imagefont.py b/Tests/test_imagefont.py index 6a2d572a954..6944404c163 100644 --- a/Tests/test_imagefont.py +++ b/Tests/test_imagefont.py @@ -9,7 +9,7 @@ from PIL import Image, ImageDraw, ImageFont, features -from .helper import PillowTestCase, unittest +from .helper import PillowTestCase, is_pypy, is_win32, unittest FONT_PATH = "Tests/fonts/FreeMono.ttf" FONT_SIZE = 20 @@ -464,10 +464,7 @@ def test_unicode_pilfont(self): with self.assertRaises(UnicodeEncodeError): font.getsize(u"’") - @unittest.skipIf( - sys.version.startswith("2") or hasattr(sys, "pypy_translation_info"), - "requires CPython 3.3+", - ) + @unittest.skipIf(sys.version.startswith("2") or is_pypy(), "requires CPython 3.3+") def test_unicode_extended(self): # issue #3777 text = u"A\u278A\U0001F12B" @@ -504,7 +501,7 @@ def loadable_font(filepath, size, index, encoding, *args, **kwargs): name = font.getname() self.assertEqual(("FreeMono", "Regular"), name) - @unittest.skipIf(sys.platform.startswith("win32"), "requires Unix or macOS") + @unittest.skipIf(is_win32(), "requires Unix or macOS") def test_find_linux_font(self): # A lot of mocking here - this is more for hitting code and # catching syntax like errors @@ -550,7 +547,7 @@ def fake_walker(path): font_directory + "/Duplicate.ttf", "Duplicate" ) - @unittest.skipIf(sys.platform.startswith("win32"), "requires Unix or macOS") + @unittest.skipIf(is_win32(), "requires Unix or macOS") def test_find_macos_font(self): # Like the linux test, more cover hitting code rather than testing # correctness. diff --git a/Tests/test_imageshow.py b/Tests/test_imageshow.py index 1c756da9f7b..aac48d6c082 100644 --- a/Tests/test_imageshow.py +++ b/Tests/test_imageshow.py @@ -1,8 +1,6 @@ -import sys - from PIL import Image, ImageShow -from .helper import PillowTestCase, hopper, on_ci, on_github_actions, unittest +from .helper import PillowTestCase, hopper, is_win32, on_ci, on_github_actions, unittest class TestImageShow(PillowTestCase): @@ -37,7 +35,7 @@ def show_image(self, image, **options): ImageShow._viewers.pop(0) @unittest.skipUnless( - on_ci() and not (sys.platform == "win32" and on_github_actions()), + on_ci() and not (is_win32() and on_github_actions()), "Only run on CIs; hangs on Windows on GitHub Actions", ) def test_show(self): diff --git a/Tests/test_imagewin.py b/Tests/test_imagewin.py index 92fcdc28d60..2b203418752 100644 --- a/Tests/test_imagewin.py +++ b/Tests/test_imagewin.py @@ -1,8 +1,6 @@ -import sys - from PIL import ImageWin -from .helper import PillowTestCase, hopper, unittest +from .helper import PillowTestCase, hopper, is_win32, unittest class TestImageWin(PillowTestCase): @@ -32,7 +30,7 @@ def test_hwnd(self): self.assertEqual(wnd2, 50) -@unittest.skipUnless(sys.platform.startswith("win32"), "Windows only") +@unittest.skipUnless(is_win32(), "Windows only") class TestImageWinDib(PillowTestCase): def test_dib_image(self): # Arrange diff --git a/Tests/test_imagewin_pointers.py b/Tests/test_imagewin_pointers.py index efa3753b951..d7c22a209e6 100644 --- a/Tests/test_imagewin_pointers.py +++ b/Tests/test_imagewin_pointers.py @@ -1,14 +1,13 @@ import ctypes -import sys from io import BytesIO from PIL import Image, ImageWin -from .helper import PillowTestCase, hopper +from .helper import PillowTestCase, hopper, is_win32 # see https://github.com/python-pillow/Pillow/pull/1431#issuecomment-144692652 -if sys.platform.startswith("win32"): +if is_win32(): import ctypes.wintypes class BITMAPFILEHEADER(ctypes.Structure): diff --git a/Tests/test_main.py b/Tests/test_main.py index 936a938f95b..c6f9a694e68 100644 --- a/Tests/test_main.py +++ b/Tests/test_main.py @@ -5,14 +5,12 @@ import sys from unittest import TestCase -from .helper import on_github_actions, unittest +from .helper import is_pypy, is_win32, on_github_actions, unittest class TestMain(TestCase): @unittest.skipIf( - sys.platform == "win32" - and hasattr(sys, "pypy_translation_info") - and on_github_actions(), + is_win32() and is_pypy() and on_github_actions(), "Failing on Windows on GitHub Actions running PyPy", ) def test_main(self): diff --git a/Tests/test_map.py b/Tests/test_map.py index 3fc42651b30..8d4e32219d8 100644 --- a/Tests/test_map.py +++ b/Tests/test_map.py @@ -2,7 +2,7 @@ from PIL import Image -from .helper import PillowTestCase, unittest +from .helper import PillowTestCase, is_win32, unittest try: import numpy @@ -10,7 +10,7 @@ numpy = None -@unittest.skipIf(sys.platform.startswith("win32"), "Win32 does not call map_buffer") +@unittest.skipIf(is_win32(), "Win32 does not call map_buffer") class TestMap(PillowTestCase): def test_overflow(self): # There is the potential to overflow comparisons in map.c diff --git a/Tests/test_shell_injection.py b/Tests/test_shell_injection.py index 35a3dcfcd86..97774a0a43b 100644 --- a/Tests/test_shell_injection.py +++ b/Tests/test_shell_injection.py @@ -1,5 +1,4 @@ import shutil -import sys from PIL import GifImagePlugin, Image, JpegImagePlugin @@ -7,6 +6,7 @@ PillowTestCase, cjpeg_available, djpeg_available, + is_win32, netpbm_available, unittest, ) @@ -17,7 +17,7 @@ test_filenames = ("temp_';", 'temp_";', "temp_'\"|", "temp_'\"||", "temp_'\"&&") -@unittest.skipIf(sys.platform.startswith("win32"), "requires Unix or macOS") +@unittest.skipIf(is_win32(), "requires Unix or macOS") class TestShellInjection(PillowTestCase): def assert_save_filename_check(self, src_img, save_func): for filename in test_filenames: From 04868c9e51e781601e0c4fc5f5d26f684c69a909 Mon Sep 17 00:00:00 2001 From: nulano Date: Thu, 26 Sep 2019 10:10:37 +0200 Subject: [PATCH 13/20] winbuild use lcms2-2.8 for python3.x; use static freetype on GHA --- .github/workflows/test-windows.yml | 11 ++++------- winbuild/build_dep.py | 3 +++ winbuild/config.py | 7 ++++++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 33123b17839..9faec2c5604 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -147,26 +147,23 @@ jobs: 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" - %MSBUILD% builds\windows\vc2010\freetype.sln /t:Build /p:Configuration="Release" /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% - copy /Y /B objs\${{ matrix.platform-msbuild }}\Release\freetype.dll %INCLIB% - copy /Y /B objs\${{ matrix.platform-msbuild }}\Release\freetype.lib %INCLIB% + copy /Y /B "objs\${{ matrix.platform-msbuild }}\Release Static\freetype.lib" %INCLIB% - name: Build dependencies / LCMS2 - if: false run: | - REM Projects\VC2015\lcms2.sln is not available in lcms2-2.7 - 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%\lcms2-2.7 + cd /D %BUILD%\lcms2-2.8 call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 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 'MultiThreadedDLL', 'MultiThreaded' | Out-File -encoding ASCII Projects\VC2015\lcms2_static\lcms2_static.vcxproj" %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% diff --git a/winbuild/build_dep.py b/winbuild/build_dep.py index 487329db8b5..3ed727ef876 100644 --- a/winbuild/build_dep.py +++ b/winbuild/build_dep.py @@ -270,6 +270,7 @@ def build_lcms_70(compiler): r""" rem Build lcms2 setlocal +set LCMS=%%LCMS-2.7%% rd /S /Q %%LCMS%%\Lib rd /S /Q %%LCMS%%\Projects\VC%(vc_version)s\Release %%MSBUILD%% %%LCMS%%\Projects\VC%(vc_version)s\lcms2.sln /t:Clean /p:Configuration="Release" /p:Platform=Win32 /m @@ -287,8 +288,10 @@ def build_lcms_71(compiler): r""" rem Build lcms2 setlocal +set LCMS=%%LCMS-2.8%% rd /S /Q %%LCMS%%\Lib rd /S /Q %%LCMS%%\Projects\VC%(vc_version)s\Release +powershell -Command "(gc Projects\VC2015\lcms2_static\lcms2_static.vcxproj) -replace 'MultiThreadedDLL', 'MultiThreaded' | Out-File -encoding ASCII Projects\VC2015\lcms2_static\lcms2_static.vcxproj" %%MSBUILD%% %%LCMS%%\Projects\VC%(vc_version)s\lcms2.sln /t:Clean /p:Configuration="Release" /p:Platform=%(platform)s /m %%MSBUILD%% %%LCMS%%\Projects\VC%(vc_version)s\lcms2.sln /t:lcms2_static /p:Configuration="Release" /p:Platform=%(platform)s /m xcopy /Y /E /Q %%LCMS%%\include %%INCLIB%% diff --git a/winbuild/config.py b/winbuild/config.py index 77be977696b..a8fce3005d4 100644 --- a/winbuild/config.py +++ b/winbuild/config.py @@ -44,11 +44,16 @@ "filename": PILLOW_DEPENDS_DIR + "freetype-2.10.1.tar.gz", "dir": "freetype-2.10.1", }, - "lcms": { + "lcms-2.7": { "url": SF_MIRROR + "/project/lcms/lcms/2.7/lcms2-2.7.zip", "filename": PILLOW_DEPENDS_DIR + "lcms2-2.7.zip", "dir": "lcms2-2.7", }, + "lcms-2.8": { + "url": SF_MIRROR + "/project/lcms/lcms/2.8/lcms2-2.8.zip", + "filename": PILLOW_DEPENDS_DIR + "lcms2-2.8.zip", + "dir": "lcms2-2.8", + }, "ghostscript": { "url": "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs927/ghostscript-9.27.tar.gz", # noqa: E501 "filename": PILLOW_DEPENDS_DIR + "ghostscript-9.27.tar.gz", From b81f5481b8f24bede9958b688926e056a894205b Mon Sep 17 00:00:00 2001 From: nulano Date: Thu, 26 Sep 2019 20:30:03 +0200 Subject: [PATCH 14/20] test-windows.yml fix LNK4098 for CPython --- .github/workflows/test-windows.yml | 14 +- winbuild/build_dep.py | 2 +- winbuild/{nmake.opt => tiff-md.opt} | 0 winbuild/tiff-mt.opt | 216 ++++++++++++++++++++++++++++ 4 files changed, 225 insertions(+), 7 deletions(-) rename winbuild/{nmake.opt => tiff-md.opt} (100%) create mode 100644 winbuild/tiff-mt.opt diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 9faec2c5604..3f22b458a93 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -99,7 +99,7 @@ jobs: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 echo on nmake -nologo -f win32\Makefile.msc clean - nmake -nologo -f win32\Makefile.msc zlib.lib + nmake -nologo -f win32\Makefile.msc LOC=-MT zlib.lib copy /Y /B z*.h %INCLIB% copy /Y /B *.lib %INCLIB% copy /Y /B zlib.lib %INCLIB%\z.lib @@ -112,7 +112,7 @@ jobs: 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 echo on - copy %GITHUB_WORKSPACE%\winbuild\nmake.opt nmake.opt + copy %GITHUB_WORKSPACE%\winbuild\tiff-mt.opt nmake.opt nmake -nologo -f makefile.vc clean nmake -nologo -f makefile.vc lib copy /Y /B libtiff\tiff*.h %INCLIB% @@ -176,7 +176,10 @@ jobs: 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 echo on - cmake.exe -DBUILD_THIRDPARTY:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" . + set CMAKE=cmake.exe -DOPENJP2_COMPILE_OPTIONS=-MT + set CMAKE=%CMAKE% -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF + set CMAKE=%CMAKE% -DBUILD_THIRDPARTY:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF + %CMAKE% -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" . nmake -nologo -f Makefile clean nmake -nologo -f Makefile mkdir %INCLIB%\openjpeg-2.3.1 @@ -209,8 +212,7 @@ jobs: 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 - %PYTHON%\python.exe setup.py build_ext --add-imaging-libs=msvcrt install - %PYTHON%\python.exe -c "from PIL import _webp;import os, shutil;shutil.copy(r'%INCLIB%\freetype.dll', os.path.dirname(_webp.__file__));" + %PYTHON%\python.exe setup.py build_ext install %PYTHON%\python.exe selftest.py --installed - name: Test Pillow @@ -242,7 +244,7 @@ jobs: 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 - %PYTHON%\python.exe setup.py build_ext --add-imaging-libs=msvcrt bdist_wheel + %PYTHON%\python.exe setup.py bdist_wheel - uses: actions/upload-artifact@v1 if: "github.event_name == 'push' && !contains(matrix.python-version, 'pypy')" diff --git a/winbuild/build_dep.py b/winbuild/build_dep.py index 3ed727ef876..4e4b70dfee6 100644 --- a/winbuild/build_dep.py +++ b/winbuild/build_dep.py @@ -202,7 +202,7 @@ def nmake_libs(compiler, bit): + vc_setup(compiler, bit) + r""" rem do after building jpeg and zlib -copy %%~dp0\nmake.opt %%TIFF%% +copy %%~dp0\tiff-md.opt %%TIFF%%\nmake.opt cd /D %%TIFF%% nmake -nologo -f makefile.vc clean diff --git a/winbuild/nmake.opt b/winbuild/tiff-md.opt similarity index 100% rename from winbuild/nmake.opt rename to winbuild/tiff-md.opt diff --git a/winbuild/tiff-mt.opt b/winbuild/tiff-mt.opt new file mode 100644 index 00000000000..9298f4ca71d --- /dev/null +++ b/winbuild/tiff-mt.opt @@ -0,0 +1,216 @@ +# $Id: nmake.opt,v 1.18 2006/06/07 16:33:45 dron Exp $ +# +# Copyright (C) 2004, Andrey Kiselev +# +# Permission to use, copy, modify, distribute, and sell this software and +# its documentation for any purpose is hereby granted without fee, provided +# that (i) the above copyright notices and this permission notice appear in +# all copies of the software and related documentation, and (ii) the names of +# Sam Leffler and Silicon Graphics may not be used in any advertising or +# publicity relating to the software without the specific, prior written +# permission of Sam Leffler and Silicon Graphics. +# +# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. +# +# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR +# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, +# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF +# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE +# OF THIS SOFTWARE. + +# Compile time parameters for MS Visual C++ compiler. +# You may edit this file to specify building options. + +# +###### Edit the following lines to choose a feature set you need. ####### +# + +# +# Select WINMODE_CONSOLE to build a library which reports errors to stderr, or +# WINMODE_WINDOWED to build such that errors are reported via MessageBox(). +# +WINMODE_CONSOLE = 1 +#WINMODE_WINDOWED = 1 + +# +# Comment out the following lines to disable internal codecs. +# +# Support for CCITT Group 3 & 4 algorithms +CCITT_SUPPORT = 1 +# Support for Macintosh PackBits algorithm +PACKBITS_SUPPORT = 1 +# Support for LZW algorithm +LZW_SUPPORT = 1 +# Support for ThunderScan 4-bit RLE algorithm +THUNDER_SUPPORT = 1 +# Support for NeXT 2-bit RLE algorithm +NEXT_SUPPORT = 1 +# Support for LogLuv high dynamic range encoding +LOGLUV_SUPPORT = 1 + +# +# Uncomment and edit following lines to enable JPEG support. +# +JPEG_SUPPORT = 1 +JPEG_INCLUDE = -I$(INCLIB) +JPEG_LIB = $(INCLIB)/libjpeg.lib + +# +# Uncomment and edit following lines to enable ZIP support +# (required for Deflate compression and Pixar log-format) +# +ZIP_SUPPORT = 1 +ZLIB_INCLUDE = -I$(INCLIB) +ZLIB_LIB = $(INCLIB)/zlib.lib + +# +# Uncomment and edit following lines to enable ISO JBIG support +# +#JBIG_SUPPORT = 1 +#JBIGDIR = d:/projects/jbigkit +#JBIG_INCLUDE = -I$(JBIGDIR)/libjbig +#JBIG_LIB = $(JBIGDIR)/libjbig/jbig.lib + +# +# Uncomment following line to enable Pixar log-format algorithm +# (Zlib required). +# +#PIXARLOG_SUPPORT = 1 + +# +# Comment out the following lines to disable strip chopping +# (whether or not to convert single-strip uncompressed images to multiple +# strips of specified size to reduce memory usage). Default strip size +# is 8192 bytes, it can be configured via the STRIP_SIZE_DEFAULT parameter +# +STRIPCHOP_SUPPORT = 1 +STRIP_SIZE_DEFAULT = 8192 + +# +# Comment out the following lines to disable treating the fourth sample with +# no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA +# files but don't mark the alpha properly. +# +EXTRASAMPLE_AS_ALPHA_SUPPORT = 1 + +# +# Comment out the following lines to disable picking up YCbCr subsampling +# info from the JPEG data stream to support files lacking the tag. +# See Bug 168 in Bugzilla, and JPEGFixupTestSubsampling() for details. +# +CHECK_JPEG_YCBCR_SUBSAMPLING = 1 + +# +####################### Compiler related options. ####################### +# + +# +# Pick debug or optimized build flags. We default to an optimized build +# with no debugging information. +# NOTE: /EHsc option required if you want to build the C++ stream API +# +OPTFLAGS = /Ox /MT /EHsc /W3 /D_CRT_SECURE_NO_DEPRECATE +#OPTFLAGS = /Zi + +# +# Uncomment following line to enable using Windows Common RunTime Library +# instead of Windows specific system calls. See notes on top of tif_unix.c +# module for details. +# +USE_WIN_CRT_LIB = 1 + +# Compiler specific options. You may probably want to adjust compilation +# parameters in CFLAGS variable. Refer to your compiler documentation +# for the option reference. +# +MAKE = nmake /nologo +CC = cl /nologo +CXX = cl /nologo +AR = lib /nologo +LD = link /nologo + +CFLAGS = $(OPTFLAGS) $(INCL) $(EXTRAFLAGS) +CXXFLAGS = $(OPTFLAGS) $(INCL) $(EXTRAFLAGS) +EXTRAFLAGS = +LIBS = + +# Name of the output shared library +DLLNAME = libtiff.dll + +# +########### There is nothing to edit below this line normally. ########### +# + +# Set the native cpu bit order +EXTRAFLAGS = -DFILLODER_LSB2MSB $(EXTRAFLAGS) + +!IFDEF WINMODE_WINDOWED +EXTRAFLAGS = -DTIF_PLATFORM_WINDOWED $(EXTRAFLAGS) +LIBS = user32.lib $(LIBS) +!ELSE +EXTRAFLAGS = -DTIF_PLATFORM_CONSOLE $(EXTRAFLAGS) +!ENDIF + +# Codec stuff +!IFDEF CCITT_SUPPORT +EXTRAFLAGS = -DCCITT_SUPPORT $(EXTRAFLAGS) +!ENDIF + +!IFDEF PACKBITS_SUPPORT +EXTRAFLAGS = -DPACKBITS_SUPPORT $(EXTRAFLAGS) +!ENDIF + +!IFDEF LZW_SUPPORT +EXTRAFLAGS = -DLZW_SUPPORT $(EXTRAFLAGS) +!ENDIF + +!IFDEF THUNDER_SUPPORT +EXTRAFLAGS = -DTHUNDER_SUPPORT $(EXTRAFLAGS) +!ENDIF + +!IFDEF NEXT_SUPPORT +EXTRAFLAGS = -DNEXT_SUPPORT $(EXTRAFLAGS) +!ENDIF + +!IFDEF LOGLUV_SUPPORT +EXTRAFLAGS = -DLOGLUV_SUPPORT $(EXTRAFLAGS) +!ENDIF + +!IFDEF JPEG_SUPPORT +LIBS = $(LIBS) $(JPEG_LIB) +EXTRAFLAGS = -DJPEG_SUPPORT -DOJPEG_SUPPORT $(EXTRAFLAGS) +!ENDIF + +!IFDEF ZIP_SUPPORT +LIBS = $(LIBS) $(ZLIB_LIB) +EXTRAFLAGS = -DZIP_SUPPORT $(EXTRAFLAGS) +!IFDEF PIXARLOG_SUPPORT +EXTRAFLAGS = -DPIXARLOG_SUPPORT $(EXTRAFLAGS) +!ENDIF +!ENDIF + +!IFDEF JBIG_SUPPORT +LIBS = $(LIBS) $(JBIG_LIB) +EXTRAFLAGS = -DJBIG_SUPPORT $(EXTRAFLAGS) +!ENDIF + +!IFDEF STRIPCHOP_SUPPORT +EXTRAFLAGS = -DSTRIPCHOP_DEFAULT=TIFF_STRIPCHOP -DSTRIP_SIZE_DEFAULT=$(STRIP_SIZE_DEFAULT) $(EXTRAFLAGS) +!ENDIF + +!IFDEF EXTRASAMPLE_AS_ALPHA_SUPPORT +EXTRAFLAGS = -DDEFAULT_EXTRASAMPLE_AS_ALPHA $(EXTRAFLAGS) +!ENDIF + +!IFDEF CHECK_JPEG_YCBCR_SUBSAMPLING +EXTRAFLAGS = -DCHECK_JPEG_YCBCR_SUBSAMPLING $(EXTRAFLAGS) +!ENDIF + +!IFDEF USE_WIN_CRT_LIB +EXTRAFLAGS = -DAVOID_WIN32_FILEIO $(EXTRAFLAGS) +!ELSE +EXTRAFLAGS = -DUSE_WIN32_FILEIO $(EXTRAFLAGS) +!ENDIF From d05655095b25a223938bf2dd3266068d5d4f2350 Mon Sep 17 00:00:00 2001 From: nulano Date: Fri, 27 Sep 2019 10:18:32 +0200 Subject: [PATCH 15/20] test-windows.yml libjpeg-turbo --- .github/workflows/test-windows.yml | 30 +++++++++++++++++++++++++++--- winbuild/config.py | 7 ++++++- 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 3f22b458a93..b42dabf3949 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -62,6 +62,11 @@ jobs: - name: Fetch dependencies run: | + curl -fsSL -o nasm.zip https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/win64/nasm-2.14.02-win64.zip + 7z x nasm.zip "-o$env:RUNNER_WORKSPACE\" + Write-Host "`#`#[add-path]$env:RUNNER_WORKSPACE\nasm-2.14.02" + Write-Host "::add-path::$env:RUNNER_WORKSPACE\nasm-2.14.02" + $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:\ @@ -76,7 +81,9 @@ jobs: EXECUTABLE: bin\python.exe shell: pwsh + # libjpeg-turbo build is slow, pypy test is slow -> don't do both at once - name: Build dependencies / libjpeg + if: "contains(matrix.python-version, 'pypy')" run: | set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 @@ -90,6 +97,23 @@ jobs: copy /Y /B j*.h %INCLIB% copy /Y /B *.lib %INCLIB% + - name: Build dependencies / libjpeg-turbo + if: "!contains(matrix.python-version, 'pypy')" + 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%\libjpeg-turbo-2.0.3 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 + 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 -DCMAKE_BUILD_TYPE=Release + %CMAKE% -G "NMake Makefiles" . + nmake -nologo -f Makefile clean + nmake -nologo -f Makefile + copy /Y /B j*.h %INCLIB% + copy /Y /B jpeg-static.lib %INCLIB%\libjpeg.lib + - name: Build dependencies / zlib run: | set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include @@ -176,10 +200,10 @@ jobs: 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 echo on - set CMAKE=cmake.exe -DOPENJP2_COMPILE_OPTIONS=-MT - set CMAKE=%CMAKE% -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 - %CMAKE% -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles" . + set CMAKE=%CMAKE% -DOPENJP2_COMPILE_OPTIONS=-MT -DCMAKE_BUILD_TYPE=Release + %CMAKE% -G "NMake Makefiles" . nmake -nologo -f Makefile clean nmake -nologo -f Makefile mkdir %INCLIB%\openjpeg-2.3.1 diff --git a/winbuild/config.py b/winbuild/config.py index a8fce3005d4..728fd5ced18 100644 --- a/winbuild/config.py +++ b/winbuild/config.py @@ -1,6 +1,6 @@ import os -SF_MIRROR = "http://iweb.dl.sourceforge.net" +SF_MIRROR = "https://iweb.dl.sourceforge.net" PILLOW_DEPENDS_DIR = "C:\\pillow-depends\\" pythons = { @@ -91,6 +91,11 @@ "filename": PILLOW_DEPENDS_DIR + "openjpeg-2.3.1.tar.gz", "dir": "openjpeg-2.3.1", }, + "jpeg-turbo": { + "url": SF_MIRROR + "/project/libjpeg-turbo/2.0.3/libjpeg-turbo-2.0.3.tar.gz", + "filename": PILLOW_DEPENDS_DIR + "libjpeg-turbo-2.0.3.tar.gz", + "dir": "libjpeg-turbo-2.0.3", + }, } compilers = { From 58f1a143a21c861f006287490f0698e973cb277f Mon Sep 17 00:00:00 2001 From: nulano Date: Fri, 27 Sep 2019 12:37:54 +0200 Subject: [PATCH 16/20] test-windows.yml imagequant --- .github/workflows/test-windows.yml | 22 ++++++++++++++++++++++ winbuild/config.py | 7 +++++++ 2 files changed, 29 insertions(+) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index b42dabf3949..26f7ef6a3a8 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -210,6 +210,28 @@ jobs: copy /Y /B src\lib\openjp2\*.h %INCLIB%\openjpeg-2.3.1 copy /Y /B bin\*.lib %INCLIB% + # GPL licensed; skip if building wheels + - name: Build dependencies / libimagequant + if: "github.event_name != 'push' || contains(matrix.python-version, 'pypy')" + 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 + 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 + echo on + echo (gc CMakeLists.txt) -replace 'add_library', "add_compile_options(-MT -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 + powershell .\patch.ps1 + set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF + set CMAKE=%CMAKE% -DCMAKE_BUILD_TYPE=Release + %CMAKE% -G "NMake Makefiles" . + nmake -nologo -f Makefile clean + nmake -nologo -f Makefile + copy /Y /B *.h %INCLIB% + copy /Y /B *.lib %INCLIB% + - name: Build dependencies / ghostscript run: | set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include diff --git a/winbuild/config.py b/winbuild/config.py index 728fd5ced18..962f0112b75 100644 --- a/winbuild/config.py +++ b/winbuild/config.py @@ -96,6 +96,13 @@ "filename": PILLOW_DEPENDS_DIR + "libjpeg-turbo-2.0.3.tar.gz", "dir": "libjpeg-turbo-2.0.3", }, + # ba653c8: Merge tag '2.12.5' into msvc + "imagequant": { + "url": "https://github.com/ImageOptim/libimagequant/archive/ba653c8ccb34dde4e21c6076d85a72d21ed9d971.zip", # noqa: E501 + "filename": PILLOW_DEPENDS_DIR + + "libimagequant-ba653c8ccb34dde4e21c6076d85a72d21ed9d971.zip", + "dir": "libimagequant-ba653c8ccb34dde4e21c6076d85a72d21ed9d971", + }, } compilers = { From 820d088115f228a2519398ac6cf1e7df3beb356f Mon Sep 17 00:00:00 2001 From: nulano Date: Sun, 29 Sep 2019 22:39:18 +0200 Subject: [PATCH 17/20] test-windows.yml harfbuzz --- .github/workflows/test-windows.yml | 21 +++++++++++++++++++++ winbuild/config.py | 5 +++++ 2 files changed, 26 insertions(+) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 26f7ef6a3a8..693a5f56508 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -232,7 +232,28 @@ jobs: copy /Y /B *.h %INCLIB% copy /Y /B *.lib %INCLIB% + - name: Build dependencies / harfbuzz + 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%\harfbuzz-2.6.1 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 + echo on + echo (gc CMakeLists.txt) -replace 'enable_testing', "add_compile_options(-MT)`r`nenable_testing" ^| Out-File -encoding ASCII CMakeLists.txt > patch.ps1 + powershell .\patch.ps1 + type CMakeLists.txt + set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF + set CMAKE=%CMAKE% -DCMAKE_BUILD_TYPE=Release + %CMAKE% -G "NMake Makefiles" . + nmake -nologo -f Makefile clean + nmake -nologo -f Makefile harfbuzz + copy /Y /B src\*.h %INCLIB% + copy /Y /B *.lib %INCLIB% + + - name: Build dependencies / ghostscript + if: false run: | set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 diff --git a/winbuild/config.py b/winbuild/config.py index 962f0112b75..8eabae2e94b 100644 --- a/winbuild/config.py +++ b/winbuild/config.py @@ -103,6 +103,11 @@ + "libimagequant-ba653c8ccb34dde4e21c6076d85a72d21ed9d971.zip", "dir": "libimagequant-ba653c8ccb34dde4e21c6076d85a72d21ed9d971", }, + "harfbuzz": { + "url": "https://github.com/harfbuzz/harfbuzz/archive/2.6.1.zip", + "filename": PILLOW_DEPENDS_DIR + "harfbuzz-2.6.1.zip", + "dir": "harfbuzz-2.6.1", + }, } compilers = { From a2b40f6caba9d511c947b43b5d29402b5db52afb Mon Sep 17 00:00:00 2001 From: nulano Date: Mon, 30 Sep 2019 01:04:26 +0200 Subject: [PATCH 18/20] fribidi --- .github/workflows/test-windows.yml | 19 +++++- winbuild/config.py | 5 ++ winbuild/fribidi.cmake | 104 +++++++++++++++++++++++++++++ 3 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 winbuild/fribidi.cmake diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 693a5f56508..4d117cc35d1 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -232,7 +232,7 @@ jobs: copy /Y /B *.h %INCLIB% copy /Y /B *.lib %INCLIB% - - name: Build dependencies / harfbuzz + - name: Build dependencies / HarfBuzz run: | set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 @@ -242,7 +242,6 @@ jobs: echo on echo (gc CMakeLists.txt) -replace 'enable_testing', "add_compile_options(-MT)`r`nenable_testing" ^| Out-File -encoding ASCII CMakeLists.txt > patch.ps1 powershell .\patch.ps1 - type CMakeLists.txt set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF set CMAKE=%CMAKE% -DCMAKE_BUILD_TYPE=Release %CMAKE% -G "NMake Makefiles" . @@ -251,6 +250,22 @@ jobs: copy /Y /B src\*.h %INCLIB% copy /Y /B *.lib %INCLIB% + - name: Build dependencies / FriBidi + 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%\fribidi-1.0.7 + call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 + 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 + set CMAKE=%CMAKE% -DCMAKE_BUILD_TYPE=Release + %CMAKE% -G "NMake Makefiles" . + nmake -nologo -f Makefile clean + nmake -nologo -f Makefile fribidi + copy /Y /B lib\*.h %INCLIB% + copy /Y /B *.lib %INCLIB% - name: Build dependencies / ghostscript if: false diff --git a/winbuild/config.py b/winbuild/config.py index 8eabae2e94b..93ccf38067e 100644 --- a/winbuild/config.py +++ b/winbuild/config.py @@ -108,6 +108,11 @@ "filename": PILLOW_DEPENDS_DIR + "harfbuzz-2.6.1.zip", "dir": "harfbuzz-2.6.1", }, + "fribidi": { + "url": "https://github.com/fribidi/fribidi/archive/v1.0.7.zip", + "filename": PILLOW_DEPENDS_DIR + "fribidi-1.0.7.zip", + "dir": "fribidi-1.0.7", + }, } compilers = { diff --git a/winbuild/fribidi.cmake b/winbuild/fribidi.cmake new file mode 100644 index 00000000000..82d1d9ccbb1 --- /dev/null +++ b/winbuild/fribidi.cmake @@ -0,0 +1,104 @@ +cmake_minimum_required(VERSION 3.13) + +project(fribidi) + +add_definitions(-D_CRT_SECURE_NO_WARNINGS) +set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -MT) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(lib) + +function(extract_regex_1 var text regex) + string(REGEX MATCH ${regex} _ ${text}) + set(${var} "${CMAKE_MATCH_1}" PARENT_SCOPE) +endfunction() + + +function(fribidi_conf) + file(READ configure.ac FRIBIDI_CONF) + extract_regex_1(FRIBIDI_MAJOR_VERSION "${FRIBIDI_CONF}" "\\(fribidi_major_version, ([0-9]+)\\)") + extract_regex_1(FRIBIDI_MINOR_VERSION "${FRIBIDI_CONF}" "\\(fribidi_minor_version, ([0-9]+)\\)") + extract_regex_1(FRIBIDI_MICRO_VERSION "${FRIBIDI_CONF}" "\\(fribidi_micro_version, ([0-9]+)\\)") + extract_regex_1(FRIBIDI_INTERFACE_VERSION "${FRIBIDI_CONF}" "\\(fribidi_interface_version, ([0-9]+)\\)") + extract_regex_1(FRIBIDI_INTERFACE_AGE "${FRIBIDI_CONF}" "\\(fribidi_interface_age, ([0-9]+)\\)") + extract_regex_1(FRIBIDI_BINARY_AGE "${FRIBIDI_CONF}" "\\(fribidi_binary_age, ([0-9]+)\\)") + set(FRIBIDI_VERSION "${FRIBIDI_MAJOR_VERSION}.${FRIBIDI_MINOR_VERSION}.${FRIBIDI_MICRO_VERSION}") + set(PACKAGE "fribidi") + set(PACKAGE_NAME "GNU FriBidi") + set(PACKAGE_BUGREPORT "https://github.com/fribidi/fribidi/issues/new") + set(SIZEOF_INT 4) + set(FRIBIDI_MSVC_BUILD_PLACEHOLDER "#define FRIBIDI_BUILT_WITH_MSVC") + message("detected ${PACKAGE_NAME} version ${FRIBIDI_VERSION}") + configure_file(lib/fribidi-config.h.in fribidi-config.h @ONLY) +endfunction() +fribidi_conf() + + +function(prepend var prefix) + set(out "") + foreach(f ${ARGN}) + list(APPEND out "${prefix}${f}") + endforeach() + set(${var} "${out}" PARENT_SCOPE) +endfunction() + +macro(fribidi_definitions _TGT) + target_compile_definitions(${_TGT} PUBLIC + HAVE_MEMSET + HAVE_MEMMOVE + HAVE_STRDUP + HAVE_STDLIB_H=1 + HAVE_STRING_H=1 + HAVE_MEMORY_H=1 + #HAVE_STRINGS_H + #HAVE_SYS_TIMES_H + STDC_HEADERS=1 + HAVE_STRINGIZE=1) +endmacro() + +function(fribidi_gen _NAME _OUTNAME _PARAM) + set(_OUT ${CMAKE_CURRENT_BINARY_DIR}/${_OUTNAME}) + prepend(_DEP "${CMAKE_CURRENT_SOURCE_DIR}/gen.tab/" ${ARGN}) + add_executable(gen-${_NAME} + gen.tab/gen-${_NAME}.c + gen.tab/packtab.c) + fribidi_definitions(gen-${_NAME}) + target_compile_definitions(gen-${_NAME} + PUBLIC DONT_HAVE_FRIBIDI_CONFIG_H) + add_custom_command( + COMMAND gen-${_NAME} ${_PARAM} ${_DEP} > ${_OUT} + DEPENDS ${_DEP} + OUTPUT ${_OUT}) + list(APPEND FRIBIDI_SOURCES_GENERATED "${_OUT}") + set(FRIBIDI_SOURCES_GENERATED ${FRIBIDI_SOURCES_GENERATED} PARENT_SCOPE) +endfunction() + +fribidi_gen(unicode-version fribidi-unicode-version.h "" + unidata/ReadMe.txt unidata/BidiMirroring.txt) + + +macro(fribidi_tab _NAME) + fribidi_gen(${_NAME}-tab ${_NAME}.tab.i 2 ${ARGN}) + target_sources(gen-${_NAME}-tab + PRIVATE fribidi-unicode-version.h) +endmacro() + +fribidi_tab(bidi-type unidata/UnicodeData.txt) +fribidi_tab(joining-type unidata/UnicodeData.txt unidata/ArabicShaping.txt) +fribidi_tab(arabic-shaping unidata/UnicodeData.txt) +fribidi_tab(mirroring unidata/BidiMirroring.txt) +fribidi_tab(brackets unidata/BidiBrackets.txt unidata/UnicodeData.txt) +fribidi_tab(brackets-type unidata/BidiBrackets.txt) + + +file(GLOB FRIBIDI_SOURCES lib/*.c) +file(GLOB FRIBIDI_HEADERS lib/*.h) + +add_library(fribidi STATIC + ${FRIBIDI_SOURCES} + ${FRIBIDI_HEADERS} + fribidi-config.h + ${FRIBIDI_SOURCES_GENERATED}) +fribidi_definitions(fribidi) +target_compile_definitions(fribidi + PUBLIC -DFRIBIDI_ENTRY=extern) From ae8fd7446f9520aed3cec75d04caa9ff94f822ce Mon Sep 17 00:00:00 2001 From: nulano Date: Mon, 30 Sep 2019 10:37:46 +0200 Subject: [PATCH 19/20] test-windows.yml raqm --- .github/workflows/test-windows.yml | 35 +++++++++++++++++++++----- winbuild/config.py | 5 ++++ winbuild/fribidi.cmake | 9 +++---- winbuild/raqm.cmake | 40 ++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+), 11 deletions(-) create mode 100644 winbuild/raqm.cmake diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index 4d117cc35d1..c3bb75e3cad 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -76,7 +76,6 @@ jobs: xcopy /s c:\pillow-depends\test_images\* $env:GITHUB_WORKSPACE\tests\images\ cd $env:GITHUB_WORKSPACE/winbuild/ python.exe $env:GITHUB_WORKSPACE\winbuild\build_dep.py - # .\build_deps.cmd env: EXECUTABLE: bin\python.exe shell: pwsh @@ -233,17 +232,20 @@ jobs: copy /Y /B *.lib %INCLIB% - name: Build dependencies / HarfBuzz + if: "!contains(matrix.python-version, 'pypy')" 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 + 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 echo on echo (gc CMakeLists.txt) -replace 'enable_testing', "add_compile_options(-MT)`r`nenable_testing" ^| Out-File -encoding ASCII CMakeLists.txt > patch.ps1 powershell .\patch.ps1 set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF - set CMAKE=%CMAKE% -DCMAKE_BUILD_TYPE=Release + set CMAKE=%CMAKE% -DHB_HAVE_FREETYPE:BOOL=ON -DCMAKE_BUILD_TYPE=Release %CMAKE% -G "NMake Makefiles" . nmake -nologo -f Makefile clean nmake -nologo -f Makefile harfbuzz @@ -251,6 +253,7 @@ jobs: copy /Y /B *.lib %INCLIB% - name: Build dependencies / FriBidi + if: "!contains(matrix.python-version, 'pypy')" run: | set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 @@ -267,8 +270,28 @@ jobs: copy /Y /B lib\*.h %INCLIB% copy /Y /B *.lib %INCLIB% + # failing with PyPy3 + - name: Build dependencies / Raqm + if: "!contains(matrix.python-version, 'pypy')" + 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 + 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 + 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 + set CMAKE=%CMAKE% -DCMAKE_BUILD_TYPE=Release + %CMAKE% -G "NMake Makefiles" . + nmake -nologo -f Makefile clean + nmake -nologo -f Makefile libraqm + copy /Y /B src\*.h %INCLIB% + copy /Y /B libraqm.dll %INCLIB% + - name: Build dependencies / ghostscript - if: false run: | set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 @@ -295,21 +318,21 @@ jobs: 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 %PYTHON%\python.exe setup.py build_ext install + rem Add GhostScript and Raqm binaries (copied to INCLIB) to PATH. + path %INCLIB%;%PATH% %PYTHON%\python.exe selftest.py --installed - name: Test Pillow run: | set PYTHON=%pythonLocation% set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 - rem Add GhostScript executables (copied to INCLIB) to PATH. + rem Add GhostScript and Raqm binaries (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 - name: Upload coverage run: 'codecov --file "%GITHUB_WORKSPACE%\coverage.xml" --name "%pythonLocation%"' - env: - CODECOV: Scripts\codecov.exe - name: Build wheel id: wheel diff --git a/winbuild/config.py b/winbuild/config.py index 93ccf38067e..0eccdc1f04f 100644 --- a/winbuild/config.py +++ b/winbuild/config.py @@ -113,6 +113,11 @@ "filename": PILLOW_DEPENDS_DIR + "fribidi-1.0.7.zip", "dir": "fribidi-1.0.7", }, + "libraqm": { + "url": "https://github.com/HOST-Oman/libraqm/archive/v0.7.0.zip", + "filename": PILLOW_DEPENDS_DIR + "libraqm-0.7.0.zip", + "dir": "libraqm-0.7.0", + }, } compilers = { diff --git a/winbuild/fribidi.cmake b/winbuild/fribidi.cmake index 82d1d9ccbb1..962badd4699 100644 --- a/winbuild/fribidi.cmake +++ b/winbuild/fribidi.cmake @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.13) project(fribidi) add_definitions(-D_CRT_SECURE_NO_WARNINGS) -set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -MT) +add_compile_options(-MT) include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(lib) @@ -29,7 +29,7 @@ function(fribidi_conf) set(SIZEOF_INT 4) set(FRIBIDI_MSVC_BUILD_PLACEHOLDER "#define FRIBIDI_BUILT_WITH_MSVC") message("detected ${PACKAGE_NAME} version ${FRIBIDI_VERSION}") - configure_file(lib/fribidi-config.h.in fribidi-config.h @ONLY) + configure_file(lib/fribidi-config.h.in lib/fribidi-config.h @ONLY) endfunction() fribidi_conf() @@ -57,7 +57,7 @@ macro(fribidi_definitions _TGT) endmacro() function(fribidi_gen _NAME _OUTNAME _PARAM) - set(_OUT ${CMAKE_CURRENT_BINARY_DIR}/${_OUTNAME}) + set(_OUT lib/${_OUTNAME}) prepend(_DEP "${CMAKE_CURRENT_SOURCE_DIR}/gen.tab/" ${ARGN}) add_executable(gen-${_NAME} gen.tab/gen-${_NAME}.c @@ -80,7 +80,7 @@ fribidi_gen(unicode-version fribidi-unicode-version.h "" macro(fribidi_tab _NAME) fribidi_gen(${_NAME}-tab ${_NAME}.tab.i 2 ${ARGN}) target_sources(gen-${_NAME}-tab - PRIVATE fribidi-unicode-version.h) + PRIVATE lib/fribidi-unicode-version.h) endmacro() fribidi_tab(bidi-type unidata/UnicodeData.txt) @@ -97,7 +97,6 @@ file(GLOB FRIBIDI_HEADERS lib/*.h) add_library(fribidi STATIC ${FRIBIDI_SOURCES} ${FRIBIDI_HEADERS} - fribidi-config.h ${FRIBIDI_SOURCES_GENERATED}) fribidi_definitions(fribidi) target_compile_definitions(fribidi diff --git a/winbuild/raqm.cmake b/winbuild/raqm.cmake new file mode 100644 index 00000000000..39ae915d78c --- /dev/null +++ b/winbuild/raqm.cmake @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.13) + +project(libraqm) + + +find_library(fribidi NAMES fribidi) +find_library(harfbuzz NAMES harfbuzz) +find_library(freetype NAMES freetype) + +add_definitions(-DFRIBIDI_ENTRY=extern) +add_compile_options(-MT) + + +function(raqm_conf) + file(READ configure.ac RAQM_CONF) + string(REGEX MATCH "\\[([0-9]+)\\.([0-9]+)\\.([0-9]+)\\]," _ "${RAQM_CONF}") + set(RAQM_VERSION_MAJOR "${CMAKE_MATCH_1}") + set(RAQM_VERSION_MINOR "${CMAKE_MATCH_2}") + set(RAQM_VERSION_MICRO "${CMAKE_MATCH_3}") + set(RAQM_VERSION "${RAQM_VERSION_MAJOR}.${RAQM_VERSION_MINOR}.${RAQM_VERSION_MICRO}") + message("detected libraqm version ${RAQM_VERSION}") + configure_file(src/raqm-version.h.in src/raqm-version.h @ONLY) +endfunction() +raqm_conf() + + +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +set(RAQM_SOURCES + src/raqm.c) +set(RAQM_HEADERS + src/raqm.h + src/raqm-version.h) + +add_library(libraqm SHARED + ${RAQM_SOURCES} + ${RAQM_HEADERS}) +target_link_libraries(libraqm + ${fribidi} + ${harfbuzz} + ${freetype}) From 7fb70695bde2f1283bbce6db7eb903629926890a Mon Sep 17 00:00:00 2001 From: nulano Date: Tue, 1 Oct 2019 20:32:38 +0200 Subject: [PATCH 20/20] fix distutils not finding vcredist, use /MD --- .github/workflows/test-windows.yml | 34 ++--- winbuild/build_dep.py | 2 +- winbuild/fribidi.cmake | 1 - winbuild/raqm.cmake | 1 - winbuild/tiff-mt.opt | 216 ----------------------------- winbuild/{tiff-md.opt => tiff.opt} | 0 6 files changed, 19 insertions(+), 235 deletions(-) delete mode 100644 winbuild/tiff-mt.opt rename winbuild/{tiff-md.opt => tiff.opt} (100%) diff --git a/.github/workflows/test-windows.yml b/.github/workflows/test-windows.yml index c3bb75e3cad..541fe021c22 100644 --- a/.github/workflows/test-windows.yml +++ b/.github/workflows/test-windows.yml @@ -80,10 +80,11 @@ jobs: EXECUTABLE: bin\python.exe shell: pwsh - # libjpeg-turbo build is slow, pypy test is slow -> don't do both at once - name: Build dependencies / libjpeg - if: "contains(matrix.python-version, 'pypy')" + if: false run: | + REM FIXME uses /MT not /MD, see makefile.vc and win32.mak for more info + 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 @@ -92,12 +93,12 @@ jobs: echo on nmake -nologo -f makefile.vc setup-vc6 nmake -nologo -f makefile.vc clean - nmake -nologo -f makefile.vc nodebug=1 libjpeg.lib + nmake -nologo -f makefile.vc nodebug=1 libjpeg.lib cjpeg.exe djpeg.exe copy /Y /B j*.h %INCLIB% copy /Y /B *.lib %INCLIB% + copy /Y /B *.exe %INCLIB% - name: Build dependencies / libjpeg-turbo - if: "!contains(matrix.python-version, 'pypy')" run: | set INCLUDE=C:\Program Files (x86)\Microsoft SDKs\Windows\V7.1A\Include set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 @@ -106,12 +107,14 @@ jobs: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 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 -DCMAKE_BUILD_TYPE=Release + set CMAKE=%CMAKE% -DENABLE_SHARED:BOOL=OFF -DWITH_JPEG8:BOOL=TRUE -DWITH_CRT_DLL:BOOL=TRUE -DCMAKE_BUILD_TYPE=Release %CMAKE% -G "NMake Makefiles" . nmake -nologo -f Makefile clean - nmake -nologo -f Makefile + nmake -nologo -f Makefile jpeg-static cjpeg-static djpeg-static copy /Y /B j*.h %INCLIB% copy /Y /B jpeg-static.lib %INCLIB%\libjpeg.lib + copy /Y /B cjpeg-static.exe %INCLIB%\cjpeg.exe + copy /Y /B djpeg-static.exe %INCLIB%\djpeg.exe - name: Build dependencies / zlib run: | @@ -122,7 +125,7 @@ jobs: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 echo on nmake -nologo -f win32\Makefile.msc clean - nmake -nologo -f win32\Makefile.msc LOC=-MT zlib.lib + nmake -nologo -f win32\Makefile.msc zlib.lib copy /Y /B z*.h %INCLIB% copy /Y /B *.lib %INCLIB% copy /Y /B zlib.lib %INCLIB%\z.lib @@ -135,7 +138,7 @@ jobs: 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 echo on - copy %GITHUB_WORKSPACE%\winbuild\tiff-mt.opt nmake.opt + copy %GITHUB_WORKSPACE%\winbuild\tiff.opt nmake.opt nmake -nologo -f makefile.vc clean nmake -nologo -f makefile.vc lib copy /Y /B libtiff\tiff*.h %INCLIB% @@ -151,7 +154,7 @@ jobs: call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 echo on rmdir /S /Q output\release-static - nmake -nologo -f Makefile.vc CFG=release-static RTLIBCFG=static OBJDIR=output ARCH=${{ matrix.architecture }} all + nmake -nologo -f Makefile.vc CFG=release-static OBJDIR=output ARCH=${{ matrix.architecture }} all mkdir %INCLIB%\webp copy /Y /B src\webp\*.h %INCLIB%\webp copy /Y /B output\release-static\${{ matrix.architecture }}\lib\* %INCLIB% @@ -170,6 +173,7 @@ jobs: 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" + 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% copy /Y /B "objs\${{ matrix.platform-msbuild }}\Release Static\freetype.lib" %INCLIB% @@ -186,7 +190,7 @@ jobs: 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 'MultiThreadedDLL', 'MultiThreaded' | Out-File -encoding ASCII Projects\VC2015\lcms2_static\lcms2_static.vcxproj" + powershell -Command "(gc Projects\VC2015\lcms2_static\lcms2_static.vcxproj) -replace 'MultiThreaded<', 'MultiThreadedDLL<' | Out-File -encoding ASCII Projects\VC2015\lcms2_static\lcms2_static.vcxproj" %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% @@ -201,7 +205,7 @@ jobs: 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 - set CMAKE=%CMAKE% -DOPENJP2_COMPILE_OPTIONS=-MT -DCMAKE_BUILD_TYPE=Release + set CMAKE=%CMAKE% -DCMAKE_BUILD_TYPE=Release %CMAKE% -G "NMake Makefiles" . nmake -nologo -f Makefile clean nmake -nologo -f Makefile @@ -220,7 +224,7 @@ jobs: cd /D %BUILD%\libimagequant-ba653c8ccb34dde4e21c6076d85a72d21ed9d971 call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" ${{ matrix.platform-vcvars }} 8.1 echo on - echo (gc CMakeLists.txt) -replace 'add_library', "add_compile_options(-MT -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 powershell .\patch.ps1 set CMAKE=cmake.exe -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_RULE_MESSAGES:BOOL=OFF @@ -231,6 +235,7 @@ jobs: copy /Y /B *.h %INCLIB% copy /Y /B *.lib %INCLIB% + # for Raqm - name: Build dependencies / HarfBuzz if: "!contains(matrix.python-version, 'pypy')" run: | @@ -242,8 +247,6 @@ jobs: 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 echo on - echo (gc CMakeLists.txt) -replace 'enable_testing', "add_compile_options(-MT)`r`nenable_testing" ^| Out-File -encoding ASCII CMakeLists.txt > patch.ps1 - powershell .\patch.ps1 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 %CMAKE% -G "NMake Makefiles" . @@ -252,6 +255,7 @@ jobs: copy /Y /B src\*.h %INCLIB% copy /Y /B *.lib %INCLIB% + # for Raqm - name: Build dependencies / FriBidi if: "!contains(matrix.python-version, 'pypy')" run: | @@ -313,7 +317,6 @@ jobs: set MPLSRC=%GITHUB_WORKSPACE% set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 cd /D %GITHUB_WORKSPACE% - set DISTUTILS_USE_SDK=1 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 @@ -345,7 +348,6 @@ jobs: set MPLSRC=%GITHUB_WORKSPACE% set INCLIB=%GITHUB_WORKSPACE%\winbuild\depends\msvcr10-x32 cd /D %GITHUB_WORKSPACE% - set DISTUTILS_USE_SDK=1 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 diff --git a/winbuild/build_dep.py b/winbuild/build_dep.py index 4e4b70dfee6..d7df22584ad 100644 --- a/winbuild/build_dep.py +++ b/winbuild/build_dep.py @@ -202,7 +202,7 @@ def nmake_libs(compiler, bit): + vc_setup(compiler, bit) + r""" rem do after building jpeg and zlib -copy %%~dp0\tiff-md.opt %%TIFF%%\nmake.opt +copy %%~dp0\tiff.opt %%TIFF%%\nmake.opt cd /D %%TIFF%% nmake -nologo -f makefile.vc clean diff --git a/winbuild/fribidi.cmake b/winbuild/fribidi.cmake index 962badd4699..247e79e4cdd 100644 --- a/winbuild/fribidi.cmake +++ b/winbuild/fribidi.cmake @@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.13) project(fribidi) add_definitions(-D_CRT_SECURE_NO_WARNINGS) -add_compile_options(-MT) include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(lib) diff --git a/winbuild/raqm.cmake b/winbuild/raqm.cmake index 39ae915d78c..88eb7f28479 100644 --- a/winbuild/raqm.cmake +++ b/winbuild/raqm.cmake @@ -8,7 +8,6 @@ find_library(harfbuzz NAMES harfbuzz) find_library(freetype NAMES freetype) add_definitions(-DFRIBIDI_ENTRY=extern) -add_compile_options(-MT) function(raqm_conf) diff --git a/winbuild/tiff-mt.opt b/winbuild/tiff-mt.opt deleted file mode 100644 index 9298f4ca71d..00000000000 --- a/winbuild/tiff-mt.opt +++ /dev/null @@ -1,216 +0,0 @@ -# $Id: nmake.opt,v 1.18 2006/06/07 16:33:45 dron Exp $ -# -# Copyright (C) 2004, Andrey Kiselev -# -# Permission to use, copy, modify, distribute, and sell this software and -# its documentation for any purpose is hereby granted without fee, provided -# that (i) the above copyright notices and this permission notice appear in -# all copies of the software and related documentation, and (ii) the names of -# Sam Leffler and Silicon Graphics may not be used in any advertising or -# publicity relating to the software without the specific, prior written -# permission of Sam Leffler and Silicon Graphics. -# -# THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, -# EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY -# WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. -# -# IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR -# ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, -# OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, -# WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF -# LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE -# OF THIS SOFTWARE. - -# Compile time parameters for MS Visual C++ compiler. -# You may edit this file to specify building options. - -# -###### Edit the following lines to choose a feature set you need. ####### -# - -# -# Select WINMODE_CONSOLE to build a library which reports errors to stderr, or -# WINMODE_WINDOWED to build such that errors are reported via MessageBox(). -# -WINMODE_CONSOLE = 1 -#WINMODE_WINDOWED = 1 - -# -# Comment out the following lines to disable internal codecs. -# -# Support for CCITT Group 3 & 4 algorithms -CCITT_SUPPORT = 1 -# Support for Macintosh PackBits algorithm -PACKBITS_SUPPORT = 1 -# Support for LZW algorithm -LZW_SUPPORT = 1 -# Support for ThunderScan 4-bit RLE algorithm -THUNDER_SUPPORT = 1 -# Support for NeXT 2-bit RLE algorithm -NEXT_SUPPORT = 1 -# Support for LogLuv high dynamic range encoding -LOGLUV_SUPPORT = 1 - -# -# Uncomment and edit following lines to enable JPEG support. -# -JPEG_SUPPORT = 1 -JPEG_INCLUDE = -I$(INCLIB) -JPEG_LIB = $(INCLIB)/libjpeg.lib - -# -# Uncomment and edit following lines to enable ZIP support -# (required for Deflate compression and Pixar log-format) -# -ZIP_SUPPORT = 1 -ZLIB_INCLUDE = -I$(INCLIB) -ZLIB_LIB = $(INCLIB)/zlib.lib - -# -# Uncomment and edit following lines to enable ISO JBIG support -# -#JBIG_SUPPORT = 1 -#JBIGDIR = d:/projects/jbigkit -#JBIG_INCLUDE = -I$(JBIGDIR)/libjbig -#JBIG_LIB = $(JBIGDIR)/libjbig/jbig.lib - -# -# Uncomment following line to enable Pixar log-format algorithm -# (Zlib required). -# -#PIXARLOG_SUPPORT = 1 - -# -# Comment out the following lines to disable strip chopping -# (whether or not to convert single-strip uncompressed images to multiple -# strips of specified size to reduce memory usage). Default strip size -# is 8192 bytes, it can be configured via the STRIP_SIZE_DEFAULT parameter -# -STRIPCHOP_SUPPORT = 1 -STRIP_SIZE_DEFAULT = 8192 - -# -# Comment out the following lines to disable treating the fourth sample with -# no EXTRASAMPLE_ value as being ASSOCALPHA. Many packages produce RGBA -# files but don't mark the alpha properly. -# -EXTRASAMPLE_AS_ALPHA_SUPPORT = 1 - -# -# Comment out the following lines to disable picking up YCbCr subsampling -# info from the JPEG data stream to support files lacking the tag. -# See Bug 168 in Bugzilla, and JPEGFixupTestSubsampling() for details. -# -CHECK_JPEG_YCBCR_SUBSAMPLING = 1 - -# -####################### Compiler related options. ####################### -# - -# -# Pick debug or optimized build flags. We default to an optimized build -# with no debugging information. -# NOTE: /EHsc option required if you want to build the C++ stream API -# -OPTFLAGS = /Ox /MT /EHsc /W3 /D_CRT_SECURE_NO_DEPRECATE -#OPTFLAGS = /Zi - -# -# Uncomment following line to enable using Windows Common RunTime Library -# instead of Windows specific system calls. See notes on top of tif_unix.c -# module for details. -# -USE_WIN_CRT_LIB = 1 - -# Compiler specific options. You may probably want to adjust compilation -# parameters in CFLAGS variable. Refer to your compiler documentation -# for the option reference. -# -MAKE = nmake /nologo -CC = cl /nologo -CXX = cl /nologo -AR = lib /nologo -LD = link /nologo - -CFLAGS = $(OPTFLAGS) $(INCL) $(EXTRAFLAGS) -CXXFLAGS = $(OPTFLAGS) $(INCL) $(EXTRAFLAGS) -EXTRAFLAGS = -LIBS = - -# Name of the output shared library -DLLNAME = libtiff.dll - -# -########### There is nothing to edit below this line normally. ########### -# - -# Set the native cpu bit order -EXTRAFLAGS = -DFILLODER_LSB2MSB $(EXTRAFLAGS) - -!IFDEF WINMODE_WINDOWED -EXTRAFLAGS = -DTIF_PLATFORM_WINDOWED $(EXTRAFLAGS) -LIBS = user32.lib $(LIBS) -!ELSE -EXTRAFLAGS = -DTIF_PLATFORM_CONSOLE $(EXTRAFLAGS) -!ENDIF - -# Codec stuff -!IFDEF CCITT_SUPPORT -EXTRAFLAGS = -DCCITT_SUPPORT $(EXTRAFLAGS) -!ENDIF - -!IFDEF PACKBITS_SUPPORT -EXTRAFLAGS = -DPACKBITS_SUPPORT $(EXTRAFLAGS) -!ENDIF - -!IFDEF LZW_SUPPORT -EXTRAFLAGS = -DLZW_SUPPORT $(EXTRAFLAGS) -!ENDIF - -!IFDEF THUNDER_SUPPORT -EXTRAFLAGS = -DTHUNDER_SUPPORT $(EXTRAFLAGS) -!ENDIF - -!IFDEF NEXT_SUPPORT -EXTRAFLAGS = -DNEXT_SUPPORT $(EXTRAFLAGS) -!ENDIF - -!IFDEF LOGLUV_SUPPORT -EXTRAFLAGS = -DLOGLUV_SUPPORT $(EXTRAFLAGS) -!ENDIF - -!IFDEF JPEG_SUPPORT -LIBS = $(LIBS) $(JPEG_LIB) -EXTRAFLAGS = -DJPEG_SUPPORT -DOJPEG_SUPPORT $(EXTRAFLAGS) -!ENDIF - -!IFDEF ZIP_SUPPORT -LIBS = $(LIBS) $(ZLIB_LIB) -EXTRAFLAGS = -DZIP_SUPPORT $(EXTRAFLAGS) -!IFDEF PIXARLOG_SUPPORT -EXTRAFLAGS = -DPIXARLOG_SUPPORT $(EXTRAFLAGS) -!ENDIF -!ENDIF - -!IFDEF JBIG_SUPPORT -LIBS = $(LIBS) $(JBIG_LIB) -EXTRAFLAGS = -DJBIG_SUPPORT $(EXTRAFLAGS) -!ENDIF - -!IFDEF STRIPCHOP_SUPPORT -EXTRAFLAGS = -DSTRIPCHOP_DEFAULT=TIFF_STRIPCHOP -DSTRIP_SIZE_DEFAULT=$(STRIP_SIZE_DEFAULT) $(EXTRAFLAGS) -!ENDIF - -!IFDEF EXTRASAMPLE_AS_ALPHA_SUPPORT -EXTRAFLAGS = -DDEFAULT_EXTRASAMPLE_AS_ALPHA $(EXTRAFLAGS) -!ENDIF - -!IFDEF CHECK_JPEG_YCBCR_SUBSAMPLING -EXTRAFLAGS = -DCHECK_JPEG_YCBCR_SUBSAMPLING $(EXTRAFLAGS) -!ENDIF - -!IFDEF USE_WIN_CRT_LIB -EXTRAFLAGS = -DAVOID_WIN32_FILEIO $(EXTRAFLAGS) -!ELSE -EXTRAFLAGS = -DUSE_WIN32_FILEIO $(EXTRAFLAGS) -!ENDIF diff --git a/winbuild/tiff-md.opt b/winbuild/tiff.opt similarity index 100% rename from winbuild/tiff-md.opt rename to winbuild/tiff.opt