Merge branch 'master' into master

This commit is contained in:
Hugo van Kemenade 2020-08-19 16:11:18 +03:00 committed by GitHub
commit 6fecb841b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 208 additions and 50 deletions

View File

@ -68,7 +68,7 @@ jobs:
if: "contains(matrix.python-version, '3.9-dev')" if: "contains(matrix.python-version, '3.9-dev')"
run: python -m pip install -U "setuptools>=49.3.2" run: python -m pip install -U "setuptools>=49.3.2"
- name: Prepare dependencies - name: Install dependencies
run: | run: |
7z x winbuild\depends\nasm-2.14.02-win64.zip "-o$env:RUNNER_WORKSPACE\" 7z x winbuild\depends\nasm-2.14.02-win64.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"
@ -77,41 +77,71 @@ jobs:
Write-Host "::add-path::C:\Program Files (x86)\gs\gs9.50\bin" Write-Host "::add-path::C:\Program Files (x86)\gs\gs9.50\bin"
xcopy /s winbuild\depends\test_images\* Tests\images\ xcopy /s winbuild\depends\test_images\* Tests\images\
shell: pwsh
& python.exe winbuild\build_prepare.py -v --python=$env:pythonLocation - name: Cache build
id: build-cache
uses: actions/cache@v2
with:
path: winbuild\build
key:
${{ hashFiles('winbuild\build_prepare.py') }}-${{ hashFiles('.github\workflows\test-windows.yml') }}-${{ env.pythonLocation }}
- name: Prepare build
if: steps.build-cache.outputs.cache-hit != 'true'
run: |
& python.exe winbuild\build_prepare.py -v --python=$env:pythonLocation --srcdir
shell: pwsh shell: pwsh
- name: Build dependencies / libjpeg-turbo - name: Build dependencies / libjpeg-turbo
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_libjpeg.cmd" run: "& winbuild\\build\\build_dep_libjpeg.cmd"
- name: Build dependencies / zlib - name: Build dependencies / zlib
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_zlib.cmd" run: "& winbuild\\build\\build_dep_zlib.cmd"
- name: Build dependencies / LibTiff - name: Build dependencies / LibTiff
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_libtiff.cmd" run: "& winbuild\\build\\build_dep_libtiff.cmd"
- name: Build dependencies / WebP - name: Build dependencies / WebP
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_libwebp.cmd" run: "& winbuild\\build\\build_dep_libwebp.cmd"
- name: Build dependencies / FreeType - name: Build dependencies / FreeType
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_freetype.cmd" run: "& winbuild\\build\\build_dep_freetype.cmd"
- name: Build dependencies / LCMS2 - name: Build dependencies / LCMS2
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_lcms2.cmd" run: "& winbuild\\build\\build_dep_lcms2.cmd"
- name: Build dependencies / OpenJPEG - name: Build dependencies / OpenJPEG
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_openjpeg.cmd" run: "& winbuild\\build\\build_dep_openjpeg.cmd"
# GPL licensed; skip if building wheels # GPL licensed
- name: Build dependencies / libimagequant - name: Build dependencies / libimagequant
if: "github.event_name != 'push'" if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_libimagequant.cmd" run: "& winbuild\\build\\build_dep_libimagequant.cmd"
# Raqm dependencies # Raqm dependencies
- name: Build dependencies / HarfBuzz - name: Build dependencies / HarfBuzz
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_harfbuzz.cmd" run: "& winbuild\\build\\build_dep_harfbuzz.cmd"
- name: Build dependencies / FriBidi - name: Build dependencies / FriBidi
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_fribidi.cmd" run: "& winbuild\\build\\build_dep_fribidi.cmd"
- name: Build dependencies / Raqm - name: Build dependencies / Raqm
if: steps.build-cache.outputs.cache-hit != 'true'
run: "& winbuild\\build\\build_dep_libraqm.cmd" run: "& winbuild\\build\\build_dep_libraqm.cmd"
# trim ~150MB x 9
- name: Optimize build cache
if: steps.build-cache.outputs.cache-hit != 'true'
run: rmdir /S /Q winbuild\build\src
shell: cmd
- name: Build Pillow - name: Build Pillow
run: | run: |
& winbuild\build\build_pillow.cmd install $FLAGS=""
if ('${{ github.event_name }}' -eq 'push') { $FLAGS="--disable-imagequant" }
& winbuild\build\build_pillow.cmd $FLAGS install
& $env:pythonLocation\python.exe selftest.py --installed & $env:pythonLocation\python.exe selftest.py --installed
shell: pwsh shell: pwsh
@ -156,7 +186,7 @@ jobs:
if: "github.event_name == 'push'" if: "github.event_name == 'push'"
run: | 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
winbuild\\build\\build_pillow.cmd bdist_wheel" winbuild\\build\\build_pillow.cmd --disable-imagequant bdist_wheel
shell: cmd shell: cmd
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
@ -188,23 +218,22 @@ jobs:
- name: Install Dependencies - name: Install Dependencies
run: | run: |
pacman -S --noconfirm \ pacman -S --noconfirm \
mingw-w64-x86_64-python3-cffi \
mingw-w64-x86_64-python3-numpy \
mingw-w64-x86_64-python3-olefile \
mingw-w64-x86_64-python3-pip \ mingw-w64-x86_64-python3-pip \
mingw-w64-x86_64-python3-setuptools \ mingw-w64-x86_64-python3-pyqt5 \
mingw-w64-x86_64-python3-pytest \ mingw-w64-x86_64-python3-pytest \
mingw-w64-x86_64-python3-pytest-cov \ mingw-w64-x86_64-python3-pytest-cov \
mingw-w64-x86_64-python3-cffi \ mingw-w64-x86_64-python3-setuptools \
mingw-w64-x86_64-python3-olefile \
mingw-w64-x86_64-python3-numpy \
mingw-w64-x86_64-python3-pyqt5 \
mingw-w64-x86_64-python3-numpy \
mingw-w64-x86_64-freetype \ mingw-w64-x86_64-freetype \
mingw-w64-x86_64-lcms2 \
mingw-w64-x86_64-libwebp \
mingw-w64-x86_64-libjpeg-turbo \
mingw-w64-x86_64-openjpeg2 \
mingw-w64-x86_64-libimagequant \
mingw-w64-x86_64-libraqm \
mingw-w64-x86_64-ghostscript \ mingw-w64-x86_64-ghostscript \
mingw-w64-x86_64-lcms2 \
mingw-w64-x86_64-libimagequant \
mingw-w64-x86_64-libjpeg-turbo \
mingw-w64-x86_64-libraqm \
mingw-w64-x86_64-libwebp \
mingw-w64-x86_64-openjpeg2 \
subversion subversion
python3 -m pip install pyroma python3 -m pip install pyroma

View File

@ -11,6 +11,9 @@ Changelog (Pillow)
- Remove long-deprecated Image.py functions #4798 - Remove long-deprecated Image.py functions #4798
[hugovk, nulano, radarhere] [hugovk, nulano, radarhere]
- Replaced most uses of distutils with setuptools #4797, #4809, #4814, #4817, #4829
[hugovk, radarhere]
- Add MIME type to PsdImagePlugin #4788 - Add MIME type to PsdImagePlugin #4788
[samamorgan] [samamorgan]

View File

@ -101,11 +101,7 @@ Released as needed privately to individual vendors for critical security-related
cd pillow-wheels cd pillow-wheels
./update-pillow-tag.sh [[release tag]] ./update-pillow-tag.sh [[release tag]]
``` ```
* [ ] Download distributions from the [Pillow Wheel Builder container](http://a365fff413fe338398b6-1c8a9b3114517dc5fe17b7c3f8c63a43.r19.cf2.rackcdn.com/). * [ ] Download wheels from the [Pillow Wheel Builder release](https://github.com/python-pillow/pillow-wheels/releases).
```bash
wget -m -A 'Pillow-<VERSION>-*' \
http://a365fff413fe338398b6-1c8a9b3114517dc5fe17b7c3f8c63a43.r19.cf2.rackcdn.com
```
## Publicize Release ## Publicize Release

View File

@ -77,7 +77,7 @@ language = None
# List of patterns, relative to source directory, that match files and # List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files. # directories to ignore when looking for source files.
exclude_patterns = ["_build"] exclude_patterns = ["_build", "releasenotes/template.rst"]
# The reST default role (used for this markup: `text`) to use for all # The reST default role (used for this markup: `text`) to use for all
# documents. # documents.

View File

@ -18,16 +18,16 @@ Image.show command parameter
.. deprecated:: 7.2.0 .. deprecated:: 7.2.0
The ``command`` parameter was deprecated and will be removed in a future release. The ``command`` parameter was deprecated and will be removed in a future release.
Use a subclass of ``ImageShow.Viewer`` instead. Use a subclass of :py:class:`.ImageShow.Viewer` instead.
Image._showxv Image._showxv
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
.. deprecated:: 7.2.0 .. deprecated:: 7.2.0
``Image._showxv`` has been deprecated. Use :py:meth:`~PIL.Image.Image.show` ``Image._showxv`` has been deprecated. Use :py:meth:`.Image.Image.show`
instead. If custom behaviour is required, use :py:meth:`~PIL.ImageShow.register` to add instead. If custom behaviour is required, use :py:func:`.ImageShow.register` to add
a custom :py:class:`~PIL.ImageShow.Viewer` class. a custom :py:class:`.ImageShow.Viewer` class.
ImageFile.raise_ioerror ImageFile.raise_ioerror
~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~
@ -61,7 +61,7 @@ im.offset
.. deprecated:: 1.1.2 .. deprecated:: 1.1.2
.. versionremoved:: 8.0.0 .. versionremoved:: 8.0.0
``im.offset()`` has been removed, call ``ImageChops.offset()`` instead. ``im.offset()`` has been removed, call :py:func:`.ImageChops.offset()` instead.
It was documented as deprecated in PIL 1.1.2, It was documented as deprecated in PIL 1.1.2,
raised a ``DeprecationWarning`` since 1.1.5, raised a ``DeprecationWarning`` since 1.1.5,
@ -88,20 +88,21 @@ ImageCms.CmsProfile attributes
.. deprecated:: 3.2.0 .. deprecated:: 3.2.0
.. versionremoved:: 8.0.0 .. versionremoved:: 8.0.0
Some attributes in ``ImageCms.CmsProfile`` have been removed. From 6.0.0, they issued a Some attributes in :py:class:`PIL.ImageCms.CmsProfile` have been removed. From 6.0.0,
``DeprecationWarning``: they issued a ``DeprecationWarning``:
======================== ===================================================
======================== ===============================
Removed Use instead Removed Use instead
======================== =============================== ======================== ===================================================
``color_space`` Padded ``xcolor_space`` ``color_space`` Padded :py:attr:`~.CmsProfile.xcolor_space`
``pcs`` Padded ``connection_space`` ``pcs`` Padded :py:attr:`~.CmsProfile.connection_space`
``product_copyright`` Unicode ``copyright`` ``product_copyright`` Unicode :py:attr:`~.CmsProfile.copyright`
``product_desc`` Unicode ``profile_description`` ``product_desc`` Unicode :py:attr:`~.CmsProfile.profile_description`
``product_description`` Unicode ``profile_description`` ``product_description`` Unicode :py:attr:`~.CmsProfile.profile_description`
``product_manufacturer`` Unicode ``manufacturer`` ``product_manufacturer`` Unicode :py:attr:`~.CmsProfile.manufacturer`
``product_model`` Unicode ``model`` ``product_model`` Unicode :py:attr:`~.CmsProfile.model`
======================== =============================== ======================== ===================================================
Python 2.7 Python 2.7
~~~~~~~~~~ ~~~~~~~~~~

View File

@ -0,0 +1,73 @@
8.0.0
-----
Backwards Incompatible Changes
==============================
Python 3.5
^^^^^^^^^^
Pillow has dropped support for Python 3.5, which reached end-of-life on 2020-09-13.
im.offset
^^^^^^^^^
``im.offset()`` has been removed, call :py:func:`.ImageChops.offset()` instead.
Image.fromstring, im.fromstring and im.tostring
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* ``Image.fromstring()`` has been removed, call :py:func:`.Image.frombytes()` instead.
* ``im.fromstring()`` has been removed, call :py:meth:`~PIL.Image.Image.frombytes()` instead.
* ``im.tostring()`` has been removed, call :py:meth:`~PIL.Image.Image.tobytes()` instead.
ImageCms.CmsProfile attributes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Some attributes in :py:class:`PIL.ImageCms.CmsProfile` have been removed:
======================== ===================================================
Removed Use instead
======================== ===================================================
``color_space`` Padded :py:attr:`~.CmsProfile.xcolor_space`
``pcs`` Padded :py:attr:`~.CmsProfile.connection_space`
``product_copyright`` Unicode :py:attr:`~.CmsProfile.copyright`
``product_desc`` Unicode :py:attr:`~.CmsProfile.profile_description`
``product_description`` Unicode :py:attr:`~.CmsProfile.profile_description`
``product_manufacturer`` Unicode :py:attr:`~.CmsProfile.manufacturer`
``product_model`` Unicode :py:attr:`~.CmsProfile.model`
======================== ===================================================
API Changes
===========
Add MIME type to PsdImagePlugin
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"image/vnd.adobe.photoshop" is now registered as the
:py:class:`.PsdImagePlugin.PsdImageFile` MIME type.
API Additions
=============
ImageOps.autocontrast cutoffs
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Previously, the ``cutoff`` parameter of :py:func:`.ImageOps.autocontrast` could only
be a single number, used as the percent to cut off from the histogram on the low and
high ends.
Now, it can also be a tuple ``(low, high)``.
Security
========
TODO
Other Changes
=============
TODO
^^^^
TODO

View File

@ -13,6 +13,7 @@ expected to be backported to earlier versions.
.. toctree:: .. toctree::
:maxdepth: 2 :maxdepth: 2
8.0.0
7.2.0 7.2.0
7.1.2 7.1.2
7.1.1 7.1.1

View File

@ -0,0 +1,45 @@
x.y.z
-----
Backwards Incompatible Changes
==============================
TODO
^^^^
Deprecations
============
TODO
^^^^
TODO
API Changes
===========
TODO
^^^^
TODO
API Additions
=============
TODO
^^^^
TODO
Security
========
TODO
Other Changes
=============
TODO
^^^^
TODO

View File

@ -81,6 +81,9 @@ Pillow for the selected version of Python.
``winbuild\build\build_pillow.cmd bdist_wheel`` will build wheels ``winbuild\build\build_pillow.cmd bdist_wheel`` will build wheels
instead of installing Pillow. instead of installing Pillow.
You can also use ``winbuild\build\build_pillow.cmd --inplace develop`` to build
and install Pillow in develop mode (instead of ``pip install --editable``).
Testing Pillow Testing Pillow
-------------- --------------

View File

@ -251,9 +251,9 @@ deps = {
"libs": [r"*.lib"], "libs": [r"*.lib"],
}, },
"harfbuzz": { "harfbuzz": {
"url": "https://github.com/harfbuzz/harfbuzz/archive/2.7.0.zip", "url": "https://github.com/harfbuzz/harfbuzz/archive/2.7.1.zip",
"filename": "harfbuzz-2.7.0.zip", "filename": "harfbuzz-2.7.1.zip",
"dir": "harfbuzz-2.7.0", "dir": "harfbuzz-2.7.1",
"build": [ "build": [
cmd_cmake("-DHB_HAVE_FREETYPE:BOOL=TRUE"), cmd_cmake("-DHB_HAVE_FREETYPE:BOOL=TRUE"),
cmd_nmake(target="clean"), cmd_nmake(target="clean"),
@ -378,10 +378,10 @@ def extract_dep(url, filename):
print("Extracting " + filename) print("Extracting " + filename)
if filename.endswith(".zip"): if filename.endswith(".zip"):
with zipfile.ZipFile(file) as zf: with zipfile.ZipFile(file) as zf:
zf.extractall(build_dir) zf.extractall(sources_dir)
elif filename.endswith(".tar.gz") or filename.endswith(".tgz"): elif filename.endswith(".tar.gz") or filename.endswith(".tgz"):
with tarfile.open(file, "r:gz") as tgz: with tarfile.open(file, "r:gz") as tgz:
tgz.extractall(build_dir) tgz.extractall(sources_dir)
else: else:
raise RuntimeError("Unknown archive type: " + filename) raise RuntimeError("Unknown archive type: " + filename)
@ -416,7 +416,7 @@ def build_dep(name):
extract_dep(dep["url"], dep["filename"]) extract_dep(dep["url"], dep["filename"])
for patch_file, patch_list in dep.get("patch", {}).items(): for patch_file, patch_list in dep.get("patch", {}).items():
patch_file = os.path.join(build_dir, dir, patch_file.format(**prefs)) patch_file = os.path.join(sources_dir, dir, patch_file.format(**prefs))
with open(patch_file, "r") as f: with open(patch_file, "r") as f:
text = f.read() text = f.read()
for patch_from, patch_to in patch_list.items(): for patch_from, patch_to in patch_list.items():
@ -432,7 +432,7 @@ def build_dep(name):
"@echo " + ("=" * 70), "@echo " + ("=" * 70),
f"@echo ==== {banner:<60} ====", f"@echo ==== {banner:<60} ====",
"@echo " + ("=" * 70), "@echo " + ("=" * 70),
"cd /D %s" % os.path.join(build_dir, dir), "cd /D %s" % os.path.join(sources_dir, dir),
*prefs["header"], *prefs["header"],
*dep.get("build", []), *dep.get("build", []),
*get_footer(dep), *get_footer(dep),
@ -481,6 +481,7 @@ if __name__ == "__main__":
"ARCHITECTURE", "x86" if struct.calcsize("P") == 4 else "x64" "ARCHITECTURE", "x86" if struct.calcsize("P") == 4 else "x64"
) )
build_dir = os.environ.get("PILLOW_BUILD", os.path.join(winbuild_dir, "build")) build_dir = os.environ.get("PILLOW_BUILD", os.path.join(winbuild_dir, "build"))
sources_dir = ""
for arg in sys.argv[1:]: for arg in sys.argv[1:]:
if arg == "-v": if arg == "-v":
verbose = True verbose = True
@ -498,6 +499,8 @@ if __name__ == "__main__":
architecture = arg[15:] architecture = arg[15:]
elif arg.startswith("--dir="): elif arg.startswith("--dir="):
build_dir = arg[6:] build_dir = arg[6:]
elif arg == "--srcdir":
sources_dir = os.path.sep + "src"
else: else:
raise ValueError("Unknown parameter: " + arg) raise ValueError("Unknown parameter: " + arg)
@ -528,10 +531,13 @@ if __name__ == "__main__":
lib_dir = os.path.join(build_dir, "lib") lib_dir = os.path.join(build_dir, "lib")
# build directory for *.bin files # build directory for *.bin files
bin_dir = os.path.join(build_dir, "bin") bin_dir = os.path.join(build_dir, "bin")
# directory for storing project files
sources_dir = build_dir + sources_dir
shutil.rmtree(build_dir, ignore_errors=True) shutil.rmtree(build_dir, ignore_errors=True)
for path in [build_dir, inc_dir, lib_dir, bin_dir]: os.makedirs(build_dir, exist_ok=False)
os.makedirs(path) for path in [inc_dir, lib_dir, bin_dir, sources_dir]:
os.makedirs(path, exist_ok=True)
prefs = { prefs = {
# Python paths / preferences # Python paths / preferences
@ -547,6 +553,7 @@ if __name__ == "__main__":
"inc_dir": inc_dir, "inc_dir": inc_dir,
"lib_dir": lib_dir, "lib_dir": lib_dir,
"bin_dir": bin_dir, "bin_dir": bin_dir,
"src_dir": sources_dir,
# Compilers / Tools # Compilers / Tools
**msvs, **msvs,
"cmake": "cmake.exe", # TODO find CMAKE automatically "cmake": "cmake.exe", # TODO find CMAKE automatically