Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ environment:

install:
- '%PYTHON%\%EXECUTABLE% --version'
- '%PYTHON%\%EXECUTABLE% -m pip install --upgrade pip'
- curl -fsSL -o pillow-depends.zip https://github.com/python-pillow/pillow-depends/archive/main.zip
- curl -fsSL -o pillow-test-images.zip https://github.com/python-pillow/test-images/archive/main.zip
- 7z x pillow-depends.zip -oc:\
Expand Down Expand Up @@ -71,7 +72,7 @@ before_deploy:
- cd c:\pillow
- '%PYTHON%\%EXECUTABLE% -m pip install wheel'
- cd c:\pillow\winbuild\
- c:\pillow\winbuild\build\build_pillow.cmd bdist_wheel
- c:\pillow\winbuild\build\build_pillow.cmd --global-option="bdist_wheel"
- cd c:\pillow
- ps: Get-ChildItem .\dist\*.* | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ jobs:
- name: Print build system information
run: python3 .github/workflows/system-info.py

- name: python3 -m pip install setuptools wheel pytest pytest-cov pytest-timeout defusedxml
run: python3 -m pip install setuptools wheel pytest pytest-cov pytest-timeout defusedxml
- name: python3 -m pip install wheel pytest pytest-cov pytest-timeout defusedxml
run: python3 -m pip install wheel pytest pytest-cov pytest-timeout defusedxml

- name: Install dependencies
id: install
Expand Down Expand Up @@ -166,8 +166,8 @@ jobs:
- name: Build Pillow
run: |
$FLAGS=""
if ('${{ github.event_name }}' -ne 'pull_request') { $FLAGS="--disable-imagequant" }
& winbuild\build\build_pillow.cmd $FLAGS install
if ('${{ github.event_name }}' -ne 'pull_request') { $FLAGS='--global-option="--disable-imagequant"' }
& winbuild\build\build_pillow.cmd $FLAGS --global-option="install"
& $env:pythonLocation\python.exe selftest.py --installed
shell: pwsh

Expand Down Expand Up @@ -231,7 +231,7 @@ jobs:
)
)
for /f "tokens=3 delims=/" %%a in ("${{ github.ref }}") do echo dist=dist-%%a >> %GITHUB_OUTPUT%
winbuild\\build\\build_pillow.cmd --disable-imagequant bdist_wheel
winbuild\\build\\build_pillow.cmd --global-option="--disable-imagequant" --global-option="bdist_wheel"
shell: cmd

- name: Upload wheel
Expand Down
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,24 @@ repos:
hooks:
- id: check-merge-conflict
- id: check-json
- id: check-toml
- id: check-yaml

- repo: https://github.com/sphinx-contrib/sphinx-lint
rev: v0.6.7
hooks:
- id: sphinx-lint

- repo: https://github.com/tox-dev/pyproject-fmt
rev: 0.12.1
hooks:
- id: pyproject-fmt

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.13
hooks:
- id: validate-pyproject

- repo: https://github.com/tox-dev/tox-ini-fmt
rev: 1.3.0
hooks:
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=67.8",
]
10 changes: 1 addition & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ class RequiredDependencyException(Exception):


PLATFORM_MINGW = os.name == "nt" and "GCC" in sys.version
PLATFORM_PYPY = hasattr(sys, "pypy_version_info")


def _dbg(s, tp=None):
Expand Down Expand Up @@ -847,14 +846,7 @@ def build_extensions(self):
if struct.unpack("h", b"\0\1")[0] == 1:
defs.append(("WORDS_BIGENDIAN", None))

if (
sys.platform == "win32"
and sys.version_info < (3, 9)
and not (PLATFORM_PYPY or PLATFORM_MINGW)
):
defs.append(("PILLOW_VERSION", f'"\\"{PILLOW_VERSION}\\""'))
else:
defs.append(("PILLOW_VERSION", f'"{PILLOW_VERSION}"'))
defs.append(("PILLOW_VERSION", f'"{PILLOW_VERSION}"'))

self._update_extension("PIL._imaging", libs, defs)

Expand Down
4 changes: 2 additions & 2 deletions winbuild/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ set PYTHON=C:\Python38\bin
cd /D C:\Pillow\winbuild
C:\Python39\bin\python.exe build_prepare.py -v --depends=C:\pillow-depends
build\build_dep_all.cmd
build\build_pillow.cmd install
build\build_pillow.cmd --global-option="install"
cd ..
path C:\Pillow\winbuild\build\bin;%PATH%
%PYTHON%\python.exe selftest.py
%PYTHON%\python.exe -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests
build\build_pillow.cmd bdist_wheel
build\build_pillow.cmd --global-option="bdist_wheel"
```
8 changes: 4 additions & 4 deletions winbuild/build.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ Building Pillow
---------------

Once the dependencies are built, run
``winbuild\build\build_pillow.cmd install`` to build and install
``winbuild\build\build_pillow.cmd --global-option="install"`` to build and install
Pillow for the selected version of Python.
``winbuild\build\build_pillow.cmd bdist_wheel`` will build wheels
``winbuild\build\build_pillow.cmd --global-option="bdist_wheel"`` will build wheels
instead of installing Pillow.

You can also use ``winbuild\build\build_pillow.cmd --inplace develop`` to build
Expand All @@ -114,9 +114,9 @@ The following is a simplified version of the script used on AppVeyor::
cd /D C:\Pillow\winbuild
C:\Python39\bin\python.exe build_prepare.py -v --depends C:\pillow-depends
build\build_dep_all.cmd
build\build_pillow.cmd install
build\build_pillow.cmd --global-option="install"
cd ..
path C:\Pillow\winbuild\build\bin;%PATH%
%PYTHON%\python.exe selftest.py
%PYTHON%\python.exe -m pytest -vx --cov PIL --cov Tests --cov-report term --cov-report xml Tests
build\build_pillow.cmd bdist_wheel
build\build_pillow.cmd --global-option="bdist_wheel"
5 changes: 4 additions & 1 deletion winbuild/build_prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,10 @@ def build_pillow():
*prefs["header"],
cmd_set("DISTUTILS_USE_SDK", "1"), # use same compiler to build Pillow
cmd_set("py_vcruntime_redist", "true"), # always use /MD, never /MT
r'"{python_dir}\{python_exe}" setup.py build_ext --vendor-raqm --vendor-fribidi %*', # noqa: E501
r'"{python_dir}\{python_exe}" -m pip install . '
r'--global-option="--vendor-raqm" '
r'--global-option="--vendor-fribidi" '
r"%*",
]

write_script("build_pillow.cmd", lines)
Expand Down