Skip to content

Commit

Permalink
Merge branch 'python-pillow:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Mar 26, 2022
2 parents b5714aa + 77f12cd commit 91220a3
Show file tree
Hide file tree
Showing 166 changed files with 3,563 additions and 1,796 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cifuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ jobs:
language: python
dry-run: false
- name: Upload New Crash
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
path: ./out/artifacts
- name: Upload Legacy Crash
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: steps.run.outcome == 'success'
with:
name: crash
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
name: Lint

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: pre-commit cache
uses: actions/cache@v2
Expand All @@ -21,7 +21,7 @@ jobs:
lint-pre-commit-
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: "3.10"
cache: pip
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
debian-11-bullseye-x86,
fedora-34-amd64,
fedora-35-amd64,
gentoo,
ubuntu-18.04-bionic-amd64,
ubuntu-20.04-focal-amd64,
]
Expand All @@ -40,7 +41,7 @@ jobs:
name: ${{ matrix.docker }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Build system information
run: python3 .github/workflows/system-info.py
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/test-mingw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:

steps:
- name: Checkout Pillow
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Set up shell
run: echo "C:\msys64\usr\bin\" >> $env:GITHUB_PATH
Expand All @@ -45,6 +45,7 @@ jobs:
${{ matrix.package }}-python-pyqt6 \
${{ matrix.package }}-python3-setuptools \
${{ matrix.package }}-freetype \
${{ matrix.package }}-gcc \
${{ matrix.package }}-ghostscript \
${{ matrix.package }}-lcms2 \
${{ matrix.package }}-libimagequant \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-valgrind.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
name: ${{ matrix.docker }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Build system information
run: python3 .github/workflows/system-info.py
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@ jobs:

steps:
- name: Checkout Pillow
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Checkout cached dependencies
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: python-pillow/pillow-depends
path: winbuild\depends

# sets env: pythonLocation
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.architecture }}
Expand Down Expand Up @@ -137,10 +137,11 @@ jobs:
& $env:pythonLocation\python.exe selftest.py --installed
shell: pwsh

# failing with PyPy3
# skip PyPy for speed
- name: Enable heap verification
if: "!contains(matrix.python-version, 'pypy')"
run: "& 'C:\\Program Files (x86)\\Windows Kits\\10\\Debuggers\\x86\\gflags.exe' /p /enable $env:pythonLocation\\python.exe"
run: |
& reg.exe add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\python.exe" /v "GlobalFlag" /t REG_SZ /d "0x02000000" /f
- name: Test Pillow
run: |
Expand All @@ -155,7 +156,7 @@ jobs:
shell: bash

- name: Upload errors
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: errors
Expand All @@ -181,7 +182,7 @@ jobs:
winbuild\\build\\build_pillow.cmd --disable-imagequant bdist_wheel
shell: cmd

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
if: "github.event_name != 'pull_request'"
with:
name: ${{ steps.wheel.outputs.dist }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ jobs:
name: ${{ matrix.os }} Python ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
cache: pip
Expand Down Expand Up @@ -84,14 +84,14 @@ jobs:
mkdir -p Tests/errors
- name: Upload errors
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
if: failure()
with:
name: errors
path: Tests/errors

- name: Docs
if: startsWith(matrix.os, 'ubuntu') && matrix.python-version == 3.9
if: startsWith(matrix.os, 'ubuntu') && matrix.python-version == 3.10
run: |
python3 -m pip install sphinx-copybutton sphinx-issues sphinx-removed-in sphinx-rtd-theme sphinxext-opengraph
make doccheck
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tidelift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Scan
uses: tidelift/alignment-action@main
env:
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: f1d4e742c91dd5179d742b0db9293c4472b765f8 # frozen: 21.12b0
rev: fc0be6eb1e2a96091e6f64009ee5e9081bf8b6c6 # frozen: 22.1.0
hooks:
- id: black
args: ["--target-version", "py37"]
Expand All @@ -19,7 +19,7 @@ repos:
- id: yesqa

- repo: https://github.com/Lucas-C/pre-commit-hooks
rev: 3592548bbd98528887eeed63486cf6c9bae00b98 # frozen: v1.1.10
rev: ca52c4245639abd55c970e6bbbca95cab3de22d8 # frozen: v1.1.13
hooks:
- id: remove-tabs
exclude: (Makefile$|\.bat$|\.cmake$|\.eps$|\.fits$|\.opt$)
Expand Down
8 changes: 7 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
version: 2

python:
pip_install: true
install:
- method: pip
path: .
extra_requirements:
- docs
78 changes: 78 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,84 @@ Changelog (Pillow)
9.1.0 (unreleased)
------------------

- If an error occurs after creating a file, remove the file #6134
[radarhere]

- Fixed calling DisplayViewer or XVViewer without a title #6136
[radarhere]

- Retain RGBA transparency when saving multiple GIF frames #6128
[radarhere]

- Save additional ICO frames with other bit depths if supplied #6122
[radarhere]

- Handle EXIF data truncated to just the header #6124
[radarhere]

- Added support for reading BMP images with RLE8 compression #6102
[radarhere]

- Support Python distributions where _tkinter is compiled in #6006
[lukegb]

- Added support for PPM arbitrary maxval #6119
[radarhere]

- Added BigTIFF reading #6097
[radarhere]

- When converting, clip I;16 to be unsigned, not signed #6112
[radarhere]

- Fixed loading L mode GIF with transparency #6086
[radarhere]

- Improved handling of PPM header #5121
[Piolie, radarhere]

- Reset size when seeking away from "Large Thumbnail" MPO frame #6101
[radarhere]

- Replace requirements.txt with extras #6072
[hugovk, radarhere]

- Added PyEncoder and support BLP saving #6069
[radarhere]

- Handle TGA images with packets that cross scan lines #6087
[radarhere]

- Added FITS reading #6056
[radarhere, hugovk]

- Added rawmode argument to Image.getpalette() #6061
[radarhere]

- Fixed BUFR, GRIB and HDF5 stub saving #6071
[radarhere]

- Do not automatically remove temporary ImageShow files on Unix #6045
[radarhere]

- Correctly read JPEG compressed BLP images #4685
[Meithal, radarhere]

- Merged _MODE_CONV typ into ImageMode as typestr #6057
[radarhere]

- Consider palette size when converting and in getpalette() #6060
[radarhere]

- Added enums #5954
[radarhere]

- Ensure image is opaque after converting P to PA with RGB palette #6052
[radarhere]

- Attach RGBA palettes from putpalette() when suitable #6054
[radarhere]

- Added get_photoshop_blocks() to parse Photoshop TIFF tag #6030
[radarhere]

Expand Down
53 changes: 22 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ clean:

.PHONY: coverage
coverage:
pytest -qq
python3 -c "import pytest" > /dev/null 2>&1 || python3 -m pip install pytest
python3 -m pytest -qq
rm -r htmlcov || true
coverage report
python3 -c "import coverage" > /dev/null 2>&1 || python3 -m pip install coverage
python3 -m coverage report

.PHONY: doc
doc:
Expand All @@ -33,20 +35,16 @@ help:
@echo "Welcome to Pillow development. Please use \`make <target>\` where <target> is one of"
@echo " clean remove build products"
@echo " coverage run coverage test (in progress)"
@echo " doc make html docs"
@echo " docserve run an http server on the docs directory"
@echo " doc make HTML docs"
@echo " docserve run an HTTP server on the docs directory"
@echo " html to make standalone HTML files"
@echo " inplace make inplace extension"
@echo " install make and install"
@echo " install-coverage make and install with C coverage"
@echo " install-req install documentation and test dependencies"
@echo " install-venv (deprecated) install in virtualenv"
@echo " lint run the lint checks"
@echo " lint-fix run black and isort to (mostly) fix lint issues."
@echo " lint-fix run Black and isort to (mostly) fix lint issues"
@echo " release-test run code and package tests before release"
@echo " test run tests on installed pillow"
@echo " upload build and upload sdists to PyPI"
@echo " upload-test build and upload sdists to test.pythonpackages.com"
@echo " test run tests on installed Pillow"

.PHONY: inplace
inplace: clean
Expand All @@ -70,28 +68,17 @@ debug:
make clean > /dev/null
CFLAGS='-g -O0' python3 -m pip install --global-option="build_ext" . > /dev/null

.PHONY: install-req
install-req:
python3 -m pip install -r requirements.txt

.PHONY: install-venv
install-venv:
echo "'install-venv' is deprecated and will be removed in a future Pillow release"
virtualenv .
bin/pip install -r requirements.txt

.PHONY: release-test
release-test:
$(MAKE) install-req
python3 -m pip install -e .
python3 -m pip install -e .[tests]
python3 selftest.py
python3 -m pytest Tests
python3 -m pip install .
-rm dist/*.egg
-rmdir dist
python3 -m pytest -qq
check-manifest
pyroma .
python3 -m check-manifest
python3 -m pyroma .
$(MAKE) readme

.PHONY: sdist
Expand All @@ -101,26 +88,30 @@ sdist:

.PHONY: test
test:
pytest -qq
python3 -c "import pytest" > /dev/null 2>&1 || python3 -m pip install pytest
python3 -m pytest -qq

.PHONY: valgrind
valgrind:
python3 -c "import pytest_valgrind" || python3 -m pip install pytest-valgrind
python3 -c "import pytest_valgrind" > /dev/null 2>&1 || python3 -m pip install pytest-valgrind
PYTHONMALLOC=malloc valgrind --suppressions=Tests/oss-fuzz/python.supp --leak-check=no \
--log-file=/tmp/valgrind-output \
python3 -m pytest --no-memcheck -vv --valgrind --valgrind-log=/tmp/valgrind-output

.PHONY: readme
readme:
markdown2 README.md > .long-description.html && open .long-description.html
python3 -c "import markdown2" > /dev/null 2>&1 || python3 -m pip install markdown2
python3 -m markdown2 README.md > .long-description.html && open .long-description.html


.PHONY: lint
lint:
tox --help > /dev/null || python3 -m pip install tox
tox -e lint
python3 -c "import tox" > /dev/null 2>&1 || python3 -m pip install tox
python3 -m tox -e lint

.PHONY: lint-fix
lint-fix:
black --target-version py37 .
isort .
python3 -c "import black" > /dev/null 2>&1 || python3 -m pip install black
python3 -c "import isort" > /dev/null 2>&1 || python3 -m pip install isort
python3 -m black --target-version py37 .
python3 -m isort .
2 changes: 1 addition & 1 deletion Tests/32bit_segfault_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@

from PIL import Image

if sys.maxsize < 2 ** 32:
if sys.maxsize < 2**32:
im = Image.new("L", (999999, 999999), 0)
Loading

0 comments on commit 91220a3

Please sign in to comment.