Skip to content

Commit

Permalink
use cibuildwheel on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
nulano committed Nov 15, 2023
1 parent 0256797 commit e205a7a
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/wheels-test.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
echo TODO!!!!


set
28 changes: 24 additions & 4 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,36 @@ jobs:
# Install extra test images
xcopy /S /Y Tests\test-images\* Tests\images
& python.exe -m pip install cibuildwheel==2.16.2
& python.exe winbuild\build_prepare.py -v --no-imagequant --architecture=${{ matrix.arch }}
shell: pwsh
- name: Build wheels
uses: pypa/[email protected]
with:
output-dir: wheelhouse
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: "call {package}\\winbuild\\build\\build_dep_all.cmd"
CIBW_CONFIG_SETTINGS: raqm=enable raqm=vendor fribidi=vendor
CIBW_BEFORE_ALL: "{package}\\winbuild\\build\\build_dep_all.cmd"
CIBW_TEST_COMMAND: "cd /d {project} && call .github/workflows/wheels-test.cmd"
shell: cmd
- uses: actions/upload-artifact@v3
with:
path: ./wheelhouse/*.whl
Expand Down
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ before-all = ".github/workflows/wheels-dependencies.sh"
test-command = "cd {project} && .github/workflows/wheels-test.sh"
test-extras = "tests"

[[tool.cibuildwheel.overrides]]
select = "*-win*"
test-command = "cd /d {project} && call .github/workflows/wheels-test.cmd"

[tool.ruff]
line-length = 88
select = [
Expand Down
8 changes: 5 additions & 3 deletions winbuild/build_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,23 +567,25 @@ def build_dep(name: str) -> str:
*get_footer(dep),
]

if "GITHUB_ACTIONS" in os.environ:
lines = [f"echo ::group::{banner}", *lines, "echo ::endgroup::"]

write_script(file, lines)
return file


def build_dep_all() -> None:
lines = [r'call "{build_dir}\build_env.cmd"']
gha_groups = "GITHUB_ACTIONS" in os.environ
for dep_name in DEPS:
print()
if dep_name in disabled:
print(f"Skipping disabled dependency {dep_name}")
continue
script = build_dep(dep_name)
if gha_groups:
lines.append(f"@echo ::group::Running {script}")
lines.append(rf'cmd.exe /c "{{build_dir}}\{script}"')
lines.append("if errorlevel 1 echo Build failed! && exit /B 1")
if gha_groups:
lines.append("@echo ::endgroup::")
print()
lines.append("@echo All Pillow dependencies built successfully!")
write_script("build_dep_all.cmd", lines)
Expand Down

0 comments on commit e205a7a

Please sign in to comment.