forked from python-pillow/Pillow
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
326 additions
and
133 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cibuildwheel==2.16.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
param ([string]$venv, [string]$pillow="C:\pillow") | ||
$ErrorActionPreference = 'Stop' | ||
$ProgressPreference = 'SilentlyContinue' | ||
Set-PSDebug -Trace 1 | ||
if ("$venv" -like "*\cibw-run-*\pp*-win_amd64\*") { | ||
# unlike CPython, PyPy requires Visual C++ Redistributable to be installed | ||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | ||
Invoke-WebRequest -Uri 'https://aka.ms/vs/15/release/vc_redist.x64.exe' -OutFile 'vc_redist.x64.exe' | ||
C:\vc_redist.x64.exe /install /quiet /norestart | Out-Null | ||
} | ||
$env:path += ";$pillow\winbuild\build\bin\" | ||
& "$venv\Scripts\activate.ps1" | ||
& reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\python.exe" /v "GlobalFlag" /t REG_SZ /d "0x02000000" /f | ||
cd $pillow | ||
& python -VV | ||
if (!$?) { exit $LASTEXITCODE } | ||
& python selftest.py | ||
if (!$?) { exit $LASTEXITCODE } | ||
& python -m pytest -vx Tests\check_wheel.py | ||
if (!$?) { exit $LASTEXITCODE } | ||
& python -m pytest -vx Tests | ||
if (!$?) { exit $LASTEXITCODE } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,20 @@ name: Wheels | |
on: | ||
push: | ||
paths: | ||
- ".github/workflows/wheels*.yml" | ||
- ".ci/requirements-cibw.txt" | ||
- ".github/workflows/wheel*" | ||
- "wheels/*" | ||
- "winbuild/build_prepare.py" | ||
- "winbuild/fribidi.cmake" | ||
tags: | ||
- "*" | ||
pull_request: | ||
paths: | ||
- ".github/workflows/wheels*.yml" | ||
- ".ci/requirements-cibw.txt" | ||
- ".github/workflows/wheel*" | ||
- "wheels/*" | ||
- "winbuild/build_prepare.py" | ||
- "winbuild/fribidi.cmake" | ||
workflow_dispatch: | ||
|
||
permissions: | ||
|
@@ -52,14 +58,17 @@ jobs: | |
with: | ||
submodules: true | ||
|
||
- name: Build wheels | ||
uses: pypa/[email protected] | ||
- uses: actions/setup-python@v4 | ||
with: | ||
output-dir: wheelhouse | ||
python-version: "3.x" | ||
|
||
- name: Build wheels | ||
run: | | ||
python3 -m pip install -r .ci/requirements-cibw.txt | ||
python3 -m cibuildwheel --output-dir wheelhouse | ||
env: | ||
CIBW_ARCHS: ${{ matrix.archs }} | ||
CIBW_BUILD: ${{ matrix.build }} | ||
CIBW_CONFIG_SETTINGS: raqm=enable raqm=vendor fribidi=vendor | ||
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: ${{ matrix.manylinux }} | ||
CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux }} | ||
CIBW_SKIP: pp38-* | ||
|
@@ -71,6 +80,102 @@ jobs: | |
name: dist | ||
path: ./wheelhouse/*.whl | ||
|
||
windows: | ||
name: Windows ${{ matrix.arch }} | ||
runs-on: windows-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- arch: x86 | ||
cibw_arch: x86 | ||
- arch: x64 | ||
cibw_arch: AMD64 | ||
- arch: ARM64 | ||
cibw_arch: ARM64 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Checkout extra test images | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: python-pillow/test-images | ||
path: Tests\test-images | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Prepare for build | ||
run: | | ||
choco install nasm --no-progress | ||
echo "C:\Program Files\NASM" >> $env:GITHUB_PATH | ||
# Install extra test images | ||
xcopy /S /Y Tests\test-images\* Tests\images | ||
& python.exe -m pip install -r .ci/requirements-cibw.txt | ||
# Cannot cross-compile FriBiDi (only used for tests) | ||
$FLAGS = ("--no-imagequant", "--architecture=${{ matrix.arch }}") | ||
if ('${{ matrix.arch }}' -eq 'ARM64') { $FLAGS += "--no-fribidi" } | ||
& python.exe winbuild\build_prepare.py -v @FLAGS | ||
shell: pwsh | ||
|
||
- name: Build wheels | ||
run: | | ||
setlocal EnableDelayedExpansion | ||
for %%f in (winbuild\build\license\*) do ( | ||
set x=%%~nf | ||
rem Skip FriBiDi license, it is not included in the wheel. | ||
set fribidi=!x:~0,7! | ||
if NOT !fribidi!==fribidi ( | ||
rem Skip imagequant license, it is not included in the wheel. | ||
set libimagequant=!x:~0,13! | ||
if NOT !libimagequant!==libimagequant ( | ||
echo. >> LICENSE | ||
echo ===== %%~nf ===== >> LICENSE | ||
echo. >> LICENSE | ||
type %%f >> LICENSE | ||
) | ||
) | ||
) | ||
call winbuild\\build\\build_env.cmd | ||
%pythonLocation%\python.exe -m cibuildwheel . --output-dir wheelhouse | ||
env: | ||
CIBW_ARCHS: ${{ matrix.cibw_arch }} | ||
CIBW_BEFORE_ALL: "{package}\\winbuild\\build\\build_dep_all.cmd" | ||
CIBW_CACHE_PATH: "C:\\cibw" | ||
CIBW_TEST_SKIP: "*-win_arm64" | ||
CIBW_TEST_COMMAND: 'docker run --rm | ||
-v {project}:C:\pillow | ||
-v C:\cibw:C:\cibw | ||
-v %CD%\..\venv-test:%CD%\..\venv-test | ||
-e CI -e GITHUB_ACTIONS | ||
mcr.microsoft.com/windows/servercore:ltsc2022 | ||
powershell C:\pillow\.github\workflows\wheels-test.ps1 %CD%\..\venv-test' | ||
shell: cmd | ||
|
||
- name: Upload wheels | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: dist | ||
path: ./wheelhouse/*.whl | ||
|
||
- name: Prepare to upload FriBiDi | ||
if: "matrix.arch != 'ARM64'" | ||
run: | | ||
mkdir fribidi\${{ matrix.arch }} | ||
copy winbuild\build\bin\fribidi* fribidi\${{ matrix.arch }} | ||
shell: cmd | ||
|
||
- name: Upload fribidi.dll | ||
if: "matrix.arch != 'ARM64'" | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: fribidi | ||
path: fribidi\* | ||
|
||
sdist: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
@@ -93,7 +198,7 @@ jobs: | |
success: | ||
permissions: | ||
contents: none | ||
needs: [build, sdist] | ||
needs: [build, windows, sdist] | ||
runs-on: ubuntu-latest | ||
name: Wheels Successful | ||
steps: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import sys | ||
|
||
from PIL import features | ||
|
||
|
||
def test_wheel_modules(): | ||
expected_modules = {"pil", "tkinter", "freetype2", "littlecms2", "webp"} | ||
|
||
# tkinter is not available in cibuildwheel installed CPython on Windows | ||
try: | ||
import tkinter | ||
|
||
assert tkinter | ||
except ImportError: | ||
expected_modules.remove("tkinter") | ||
|
||
assert set(features.get_supported_modules()) == expected_modules | ||
|
||
|
||
def test_wheel_codecs(): | ||
expected_codecs = {"jpg", "jpg_2000", "zlib", "libtiff"} | ||
|
||
assert set(features.get_supported_codecs()) == expected_codecs | ||
|
||
|
||
def test_wheel_features(): | ||
expected_features = { | ||
"webp_anim", | ||
"webp_mux", | ||
"transp_webp", | ||
"raqm", | ||
"fribidi", | ||
"harfbuzz", | ||
"libjpeg_turbo", | ||
"xcb", | ||
} | ||
|
||
if sys.platform == "win32": | ||
expected_features.remove("xcb") | ||
|
||
assert set(features.get_supported_features()) == expected_features |
Oops, something went wrong.