Merge branch 'master' into tox-flake8

This commit is contained in:
Hugo 2019-01-27 10:53:30 +02:00 committed by GitHub
commit 84248dc642
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 127 additions and 241 deletions

View File

@ -25,8 +25,6 @@ environment:
- PYTHON: C:/Python36-x64 - PYTHON: C:/Python36-x64
- PYTHON: C:/Python35 - PYTHON: C:/Python35
- PYTHON: C:/Python35-x64 - PYTHON: C:/Python35-x64
- PYTHON: C:/Python34
- PYTHON: C:/Python34-x64
- PYTHON: C:/msys64/mingw32 - PYTHON: C:/msys64/mingw32
EXECUTABLE: bin/python3 EXECUTABLE: bin/python3
PIP_DIR: bin PIP_DIR: bin

3
.gitignore vendored
View File

@ -56,6 +56,9 @@ test_images
# Sphinx documentation # Sphinx documentation
docs/_build/ docs/_build/
# viewdoc output
.long-description.html
# Vim cruft # Vim cruft
.*.swp .*.swp

View File

@ -31,6 +31,7 @@ matrix:
dist: trusty dist: trusty
- python: "2.7_with_system_site_packages" # For PyQt4 - python: "2.7_with_system_site_packages" # For PyQt4
name: "2.7_with_system_site_packages Xenial" name: "2.7_with_system_site_packages Xenial"
services: xvfb
- python: "2.7_with_system_site_packages" # For PyQt4 - python: "2.7_with_system_site_packages" # For PyQt4
name: "2.7_with_system_site_packages Trusty" name: "2.7_with_system_site_packages Trusty"
dist: trusty dist: trusty
@ -46,9 +47,6 @@ matrix:
name: "3.5 Trusty PYTHONOPTIMIZE=2" name: "3.5 Trusty PYTHONOPTIMIZE=2"
dist: trusty dist: trusty
env: PYTHONOPTIMIZE=2 env: PYTHONOPTIMIZE=2
- python: '3.4'
name: "3.4 Trusty"
dist: trusty
- env: DOCKER="alpine" DOCKER_TAG="master" - env: DOCKER="alpine" DOCKER_TAG="master"
- env: DOCKER="arch" DOCKER_TAG="master" # contains PyQt5 - env: DOCKER="arch" DOCKER_TAG="master" # contains PyQt5
- env: DOCKER="ubuntu-trusty-x86" DOCKER_TAG="master" - env: DOCKER="ubuntu-trusty-x86" DOCKER_TAG="master"
@ -77,8 +75,11 @@ before_install:
before_script: before_script:
# Qt needs a display for some of the tests, and it's only run on the system site packages install # Qt needs a display for some of the tests, and it's only run on the system site packages install
- "export DISPLAY=:99.0" - |
- "sh -e /etc/init.d/xvfb start" if [ "$TRAVIS_JOB_NAME" == "2.7_with_system_site_packages Trusty" ]; then
export DISPLAY=:99.0
sh -e /etc/init.d/xvfb start
fi
script: script:
- | - |

View File

@ -5,6 +5,9 @@ Changelog (Pillow)
5.5.0 (unreleased) 5.5.0 (unreleased)
------------------ ------------------
- Updated libwebp to 1.0.2 #3602
[radarhere]
- Detect MIME types #3525 - Detect MIME types #3525
[radarhere] [radarhere]

View File

@ -5,23 +5,23 @@
Released quarterly on the first day of January, April, July, October. Released quarterly on the first day of January, April, July, October.
* [ ] Open a release ticket e.g. https://github.com/python-pillow/Pillow/issues/3154 * [ ] Open a release ticket e.g. https://github.com/python-pillow/Pillow/issues/3154
* [ ] Develop and prepare release in ``master`` branch. * [ ] Develop and prepare release in `master` branch.
* [ ] Check [Travis CI](https://travis-ci.org/python-pillow/Pillow) and [AppVeyor CI](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm passing tests in ``master`` branch. * [ ] Check [Travis CI](https://travis-ci.org/python-pillow/Pillow) and [AppVeyor CI](https://ci.appveyor.com/project/python-pillow/Pillow) to confirm passing tests in `master` branch.
* [ ] Check that all of the wheel builds [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels) pass the tests in Travis CI. * [ ] Check that all of the wheel builds [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels) pass the tests in Travis CI.
* [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), update version identifier in `src/PIL/_version.py` * [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), update version identifier in `src/PIL/_version.py`
* [ ] Update `CHANGES.rst`. * [ ] Update `CHANGES.rst`.
* [ ] Run pre-release check via `make release-test` in a freshly cloned repo. * [ ] Run pre-release check via `make release-test` in a freshly cloned repo.
* [ ] Create branch and tag for release e.g.: * [ ] Create branch and tag for release e.g.:
``` ```bash
$ git branch 5.2.x git branch 5.2.x
$ git tag 5.2.0 git tag 5.2.0
$ git push --all git push --all
$ git push --tags git push --tags
``` ```
* [ ] Create source distributions e.g.: * [ ] Create source distributions e.g.:
``` ```bash
$ make sdist make sdist
``` ```
* [ ] Create [binary distributions](https://github.com/python-pillow/Pillow/blob/master/RELEASING.md#binary-distributions) * [ ] Create [binary distributions](https://github.com/python-pillow/Pillow/blob/master/RELEASING.md#binary-distributions)
* [ ] Upload all binaries and source distributions e.g. `twine upload dist/Pillow-5.2.0*` * [ ] Upload all binaries and source distributions e.g. `twine upload dist/Pillow-5.2.0*`
* [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new) * [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new)
@ -31,25 +31,25 @@ Released quarterly on the first day of January, April, July, October.
Released as needed for security, installation or critical bug fixes. Released as needed for security, installation or critical bug fixes.
* [ ] Make necessary changes in ``master`` branch. * [ ] Make necessary changes in `master` branch.
* [ ] Update `CHANGES.rst`. * [ ] Update `CHANGES.rst`.
* [ ] Cherry pick individual commits from ``master`` branch to release branch e.g. ``5.2.x``.
* [ ] Check [Travis CI](https://travis-ci.org/python-pillow/Pillow) to confirm passing tests in release branch e.g. ``5.2.x``.
* [ ] Check out release branch e.g.: * [ ] Check out release branch e.g.:
``` ```bash
git checkout -t remotes/origin/5.2.x git checkout -t remotes/origin/5.2.x
``` ```
* [ ] Cherry pick individual commits from `master` branch to release branch e.g. `5.2.x`.
* [ ] Check [Travis CI](https://travis-ci.org/python-pillow/Pillow) to confirm passing tests in release branch e.g. `5.2.x`.
* [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), update version identifier in `src/PIL/_version.py` * [ ] In compliance with [PEP 440](https://www.python.org/dev/peps/pep-0440/), update version identifier in `src/PIL/_version.py`
* [ ] Run pre-release check via `make release-test`. * [ ] Run pre-release check via `make release-test`.
* [ ] Create tag for release e.g.: * [ ] Create tag for release e.g.:
``` ```bash
$ git tag 5.2.1 git tag 5.2.1
$ git push --tags git push --tags
``` ```
* [ ] Create source distributions e.g.: * [ ] Create source distributions e.g.:
``` ```bash
$ make sdist make sdist
``` ```
* [ ] Create [binary distributions](https://github.com/python-pillow/Pillow/blob/master/RELEASING.md#binary-distributions) * [ ] Create [binary distributions](https://github.com/python-pillow/Pillow/blob/master/RELEASING.md#binary-distributions)
* [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new) * [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new)
@ -64,41 +64,44 @@ Released as needed privately to individual vendors for critical security-related
* [ ] Run pre-release check via `make release-test` * [ ] Run pre-release check via `make release-test`
* [ ] Amend any commits with the CVE # * [ ] Amend any commits with the CVE #
* [ ] On release date, tag and push to GitHub. * [ ] On release date, tag and push to GitHub.
``` ```bash
git checkout 2.5.x git checkout 2.5.x
git tag 2.5.3 git tag 2.5.3
git push origin 2.5.x git push origin 2.5.x
git push origin --tags git push origin --tags
``` ```
* [ ] Create source distributions e.g.: * [ ] Create source distributions e.g.:
``` ```bash
$ make sdist make sdist
``` ```
* [ ] Create [binary distributions](https://github.com/python-pillow/Pillow/blob/master/RELEASING.md#binary-distributions) * [ ] Create [binary distributions](https://github.com/python-pillow/Pillow/blob/master/RELEASING.md#binary-distributions)
* [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new) * [ ] Create a [new release on GitHub](https://github.com/python-pillow/Pillow/releases/new)
## Binary Distributions ## Binary Distributions
### Windows ### Windows
* [ ] Contact @cgohlke for Windows binaries via release ticket e.g. https://github.com/python-pillow/Pillow/issues/1174. * [ ] Contact `@cgohlke` for Windows binaries via release ticket e.g. https://github.com/python-pillow/Pillow/issues/1174.
* [ ] Download and extract tarball from @cgohlke and ``twine upload *``. * [ ] Download and extract tarball from `@cgohlke` and `twine upload *`.
### Mac and Linux ### Mac and Linux
* [ ] Use the [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels): * [ ] Use the [Pillow Wheel Builder](https://github.com/python-pillow/pillow-wheels):
``` ```bash
$ git clone https://github.com/python-pillow/pillow-wheels git clone https://github.com/python-pillow/pillow-wheels
$ cd pillow-wheels cd pillow-wheels
$ git submodule init git submodule init
$ git submodule update Pillow git submodule update Pillow
$ cd Pillow cd Pillow
$ git fetch --all git fetch --all
$ git checkout [[release tag]] git checkout [[release tag]]
$ cd .. cd ..
$ git commit -m "Pillow -> 5.2.0" Pillow git commit -m "Pillow -> 5.2.0" Pillow
$ git push git push
``` ```
* [ ] Download distributions from the [Pillow Wheel Builder container](http://a365fff413fe338398b6-1c8a9b3114517dc5fe17b7c3f8c63a43.r19.cf2.rackcdn.com/). * [ ] Download distributions from the [Pillow Wheel Builder container](http://a365fff413fe338398b6-1c8a9b3114517dc5fe17b7c3f8c63a43.r19.cf2.rackcdn.com/).
```bash
wget -m -A 'Pillow-<VERSION>*' \
http://a365fff413fe338398b6-1c8a9b3114517dc5fe17b7c3f8c63a43.r19.cf2.rackcdn.com
```
## Publicize Release ## Publicize Release
@ -106,5 +109,4 @@ Released as needed privately to individual vendors for critical security-related
## Documentation ## Documentation
* [ ] Make sure the default version for Read the Docs is the latest tagged release e.g. ``d2d43879`` (5.4.0) * [ ] Make sure the default version for Read the Docs is the latest tagged release e.g. `d2d43879` (5.4.0)

View File

@ -195,7 +195,7 @@ class TestFileLibTiff(LibTiffTestCase):
im = Image.open('Tests/images/hopper_g4.tif') im = Image.open('Tests/images/hopper_g4.tif')
for tag in im.tag_v2: for tag in im.tag_v2:
try: try:
del(core_items[tag]) del core_items[tag]
except KeyError: except KeyError:
pass pass
@ -223,7 +223,7 @@ class TestFileLibTiff(LibTiffTestCase):
for _ in range(info.length)) for _ in range(info.length))
# Extra samples really doesn't make sense in this application. # Extra samples really doesn't make sense in this application.
del(new_ifd[338]) del new_ifd[338]
out = self.tempfile("temp.tif") out = self.tempfile("temp.tif")
TiffImagePlugin.WRITE_LIBTIFF = True TiffImagePlugin.WRITE_LIBTIFF = True

View File

@ -310,10 +310,8 @@ class TestCffi(AccessTest):
class TestEmbeddable(unittest.TestCase): class TestEmbeddable(unittest.TestCase):
@unittest.skipIf(not sys.platform.startswith('win32') or @unittest.skipIf(not sys.platform.startswith('win32') or
sys.version_info[:2] == (3, 4) or on_appveyor(),
on_appveyor(), # failing on appveyor when run from "Failing on AppVeyor when run from subprocess, not from shell")
# subprocess, not from shell
"requires Python 2.7 or >=3.5 for Windows")
def test_embeddable(self): def test_embeddable(self):
import subprocess import subprocess
import ctypes import ctypes

View File

@ -1,7 +1,6 @@
from helper import unittest, PillowTestCase from helper import unittest, PillowTestCase
from PIL import Image from PIL import Image
from PIL import ImageOps
from PIL import ImageFilter from PIL import ImageFilter
im = Image.open("Tests/images/hopper.ppm") im = Image.open("Tests/images/hopper.ppm")
@ -10,31 +9,6 @@ snakes = Image.open("Tests/images/color_snakes.png")
class TestImageOpsUsm(PillowTestCase): class TestImageOpsUsm(PillowTestCase):
def test_ops_api(self):
i = self.assert_warning(DeprecationWarning,
ImageOps.gaussian_blur, im, 2.0)
self.assertEqual(i.mode, "RGB")
self.assertEqual(i.size, (128, 128))
i = self.assert_warning(DeprecationWarning, ImageOps.box_blur, im, 1)
self.assertEqual(i.mode, "RGB")
self.assertEqual(i.size, (128, 128))
i = self.assert_warning(DeprecationWarning, ImageOps.gblur, im, 2.0)
self.assertEqual(i.mode, "RGB")
self.assertEqual(i.size, (128, 128))
i = self.assert_warning(DeprecationWarning,
ImageOps.unsharp_mask, im, 2.0, 125, 8)
self.assertEqual(i.mode, "RGB")
self.assertEqual(i.size, (128, 128))
i = self.assert_warning(DeprecationWarning,
ImageOps.usm, im, 2.0, 125, 8)
self.assertEqual(i.mode, "RGB")
self.assertEqual(i.size, (128, 128))
def test_filter_api(self): def test_filter_api(self):
test_filter = ImageFilter.GaussianBlur(2.0) test_filter = ImageFilter.GaussianBlur(2.0)

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
# install webp # install webp
archive=libwebp-1.0.1 archive=libwebp-1.0.2
./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/master/$archive.tar.gz ./download-and-extract.sh $archive https://raw.githubusercontent.com/python-pillow/pillow-depends/master/$archive.tar.gz

View File

@ -140,7 +140,7 @@ html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# Add any paths that contain custom static files (such as style sheets) here, # Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files, # relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css". # so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = ['_static'] html_static_path = ['_static', 'resources']
# Add any extra paths that contain custom files (such as robots.txt or # Add any extra paths that contain custom files (such as robots.txt or
# .htaccess) here, relative to this directory. These files are copied # .htaccess) here, relative to this directory. These files are copied

View File

@ -26,7 +26,9 @@ Notes
+--------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+ +--------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow 5.0.x - 5.1.x| | | | Yes | | | Yes | Yes | Yes | | |Pillow 5.0.x - 5.1.x| | | | Yes | | | Yes | Yes | Yes | |
+--------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+ +--------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow >= 5.2.0 | | | | Yes | | | Yes | Yes | Yes | Yes | |Pillow 5.2.x - 5.5.x| | | | Yes | | | Yes | Yes | Yes | Yes |
+--------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|Pillow >= 6.0.0 | | | | Yes | | | | Yes | Yes | Yes |
+--------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+ +--------------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
Basic Installation Basic Installation
@ -170,7 +172,7 @@ Many of Pillow's features require external libraries:
the Pillow license, therefore we will not be distributing binaries the Pillow license, therefore we will not be distributing binaries
with libimagequant support enabled. with libimagequant support enabled.
* Windows support: Libimagequant requires VS2013/MSVC 18 to compile, * Windows support: Libimagequant requires VS2013/MSVC 18 to compile,
so it is unlikely to work with any Python prior to 3.5 on Windows. so it is unlikely to work with Python 2.7 on Windows.
* **libraqm** provides complex text layout support. * **libraqm** provides complex text layout support.
@ -394,16 +396,16 @@ These platforms are built and tested for every change.
+----------------------------------+-------------------------------+-----------------------+ +----------------------------------+-------------------------------+-----------------------+
| Fedora 29 | 2.7 |x86-64 | | Fedora 29 | 2.7 |x86-64 |
+----------------------------------+-------------------------------+-----------------------+ +----------------------------------+-------------------------------+-----------------------+
| Mac OS X 10.10 Yosemite* | 2.7, 3.4, 3.5, 3.6, 3.7 |x86-64 | | Mac OS X 10.10 Yosemite* | 2.7, 3.5, 3.6, 3.7 |x86-64 |
+----------------------------------+-------------------------------+-----------------------+ +----------------------------------+-------------------------------+-----------------------+
| Ubuntu Linux 16.04 LTS | 2.7, 3.5, 3.6, 3.7, |x86-64 | | Ubuntu Linux 16.04 LTS | 2.7, 3.5, 3.6, 3.7, |x86-64 |
| | PyPy, PyPy3 | | | | PyPy, PyPy3 | |
+----------------------------------+-------------------------------+-----------------------+ +----------------------------------+-------------------------------+-----------------------+
| Ubuntu Linux 14.04 LTS | 2.7, 3.4, 3.5, 3.6 |x86-64 | | Ubuntu Linux 14.04 LTS | 2.7, 3.5, 3.6 |x86-64 |
| +-------------------------------+-----------------------+ | +-------------------------------+-----------------------+
| | 2.7 |x86 | | | 2.7 |x86 |
+----------------------------------+-------------------------------+-----------------------+ +----------------------------------+-------------------------------+-----------------------+
| Windows Server 2012 R2 | 2.7, 3.4, 3.5, 3.6, 3.7 |x86, x86-64 | | Windows Server 2012 R2 | 2.7, 3.5, 3.6, 3.7 |x86, x86-64 |
| +-------------------------------+-----------------------+ | +-------------------------------+-----------------------+
| | PyPy, 3.7/MinGW |x86 | | | PyPy, 3.7/MinGW |x86 |
+----------------------------------+-------------------------------+-----------------------+ +----------------------------------+-------------------------------+-----------------------+
@ -423,13 +425,13 @@ These platforms have been reported to work at the versions mentioned.
+----------------------------------+------------------------------+--------------------------------+-----------------------+ +----------------------------------+------------------------------+--------------------------------+-----------------------+
|**Operating system** |**Tested Python versions** |**Latest tested Pillow version**|**Tested processors** | |**Operating system** |**Tested Python versions** |**Latest tested Pillow version**|**Tested processors** |
+----------------------------------+------------------------------+--------------------------------+-----------------------+ +----------------------------------+------------------------------+--------------------------------+-----------------------+
| macOS 10.14 Mojave | 2.7, 3.4, 3.5, 3.6, 3.7 | 5.3.0 |x86-64 | | macOS 10.14 Mojave | 2.7, 3.4, 3.5, 3.6, 3.7 | 5.4.1 |x86-64 |
+----------------------------------+------------------------------+--------------------------------+-----------------------+ +----------------------------------+------------------------------+--------------------------------+-----------------------+
| macOS 10.13 High Sierra | 2.7, 3.4, 3.5, 3.6 | 4.2.1 |x86-64 | | macOS 10.13 High Sierra | 2.7, 3.4, 3.5, 3.6 | 4.2.1 |x86-64 |
+----------------------------------+------------------------------+--------------------------------+-----------------------+ +----------------------------------+------------------------------+--------------------------------+-----------------------+
| macOS 10.12 Sierra | 2.7, 3.4, 3.5, 3.6 | 4.1.1 |x86-64 | | macOS 10.12 Sierra | 2.7, 3.4, 3.5, 3.6 | 4.1.1 |x86-64 |
+----------------------------------+------------------------------+--------------------------------+-----------------------+ +----------------------------------+------------------------------+--------------------------------+-----------------------+
| Mac OS X 10.11 El Capitan | 2.7, 3.4, 3.5, 3.6, 3.7 | 5.3.0 |x86-64 | | Mac OS X 10.11 El Capitan | 2.7, 3.4, 3.5, 3.6, 3.7 | 5.4.1 |x86-64 |
| +------------------------------+--------------------------------+ + | +------------------------------+--------------------------------+ +
| | 3.3 | 4.1.0 | | | | 3.3 | 4.1.0 | |
+----------------------------------+------------------------------+--------------------------------+-----------------------+ +----------------------------------+------------------------------+--------------------------------+-----------------------+
@ -478,8 +480,6 @@ These platforms have been reported to work at the versions mentioned.
Old Versions Old Versions
------------ ------------
You can download old distributions from `PyPI You can download old distributions from the `release history at PyPI
<https://pypi.org/project/Pillow/>`_. Only the latest major <https://pypi.org/project/Pillow/#history>`_ and by direct URL access
releases for Python 2.x and 3.x are visible, but all releases are eg. https://pypi.org/project/Pillow/1.0/.
available by direct URL access
e.g. https://pypi.org/project/Pillow/1.0/.

View File

@ -5,7 +5,7 @@ jQuery(document).ready(function ($) {
$section.children('.section, .function, .method').each(function () { $section.children('.section, .function, .method').each(function () {
if ($(this).hasClass('section')) { if ($(this).hasClass('section')) {
sectionID = $(this).attr('id'); sectionID = $(this).attr('id');
search($(this), $sidebarItem.parent().find('[href=#'+sectionID+']')); search($(this), $sidebarItem.parent().find('[href="#'+sectionID+'"]'));
} else { } else {
var $dt = $(this).children('dt'); var $dt = $(this).children('dt');
var id = $dt.attr('id'); var id = $dt.attr('id');
@ -48,7 +48,7 @@ jQuery(document).ready(function ($) {
} }
}); });
}; };
search($('[itemprop=articleBody] > .section'), $('.wy-nav-side a[href=#]')); search($('[itemprop=articleBody] > .section'), $('.wy-nav-side a[href="#"]'));
}, 0); }, 0);
$(window).on('hashchange', function () { $(window).on('hashchange', function () {
$('ul[data-sectionID]').each(function () { $('ul[data-sectionID]').each(function () {

View File

@ -1,6 +1,6 @@
# A monkey patch of the base distutils.ccompiler to use parallel builds # A monkey patch of the base distutils.ccompiler to use parallel builds
# Tested on 2.7, looks to be identical to 3.3. # Tested on 2.7, looks to be identical to 3.3.
# Only applied on Python < 3.5 because otherwise, it conflicts with Python's # Only applied on Python 2.7 because otherwise, it conflicts with Python's
# own newly-added support for parallel builds. # own newly-added support for parallel builds.
from __future__ import print_function from __future__ import print_function
@ -79,6 +79,6 @@ def install():
"%s processes" % MAX_PROCS) "%s processes" % MAX_PROCS)
# We monkeypatch only versions earlier than 3.5 # We monkeypatch Python 2.7
if sys.version_info < (3, 5): if sys.version_info.major < 3:
install() install()

View File

@ -265,8 +265,8 @@ class pil_build_ext(build_ext):
if self.debug: if self.debug:
global DEBUG global DEBUG
DEBUG = True DEBUG = True
if sys.version_info >= (3, 5) and not self.parallel: if sys.version_info.major >= 3 and not self.parallel:
# For Python < 3.5, we monkeypatch distutils to have parallel # For Python 2.7, we monkeypatch distutils to have parallel
# builds. If --parallel (or -j) wasn't specified, we want to # builds. If --parallel (or -j) wasn't specified, we want to
# reproduce the same behavior as before, that is, auto-detect the # reproduce the same behavior as before, that is, auto-detect the
# number of jobs. # number of jobs.
@ -774,14 +774,13 @@ try:
"Programming Language :: Python :: 2", "Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.7", "Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.7",
"Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: Implementation :: PyPy",
], ],
python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*", python_requires=">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*",
cmdclass={"build_ext": pil_build_ext}, cmdclass={"build_ext": pil_build_ext},
ext_modules=[Extension("PIL._imaging", ["_imaging.c"])], ext_modules=[Extension("PIL._imaging", ["_imaging.c"])],
include_package_data=True, include_package_data=True,

View File

@ -958,7 +958,7 @@ class Image(object):
# color to an alpha channel. # color to an alpha channel.
new_im = self._new(self.im.convert_transparent( new_im = self._new(self.im.convert_transparent(
mode, self.info['transparency'])) mode, self.info['transparency']))
del(new_im.info['transparency']) del new_im.info['transparency']
return new_im return new_im
elif self.mode in ('L', 'RGB', 'P') and mode in ('L', 'RGB', 'P'): elif self.mode in ('L', 'RGB', 'P') and mode in ('L', 'RGB', 'P'):
t = self.info['transparency'] t = self.info['transparency']
@ -1010,14 +1010,14 @@ class Image(object):
if delete_trns: if delete_trns:
# This could possibly happen if we requantize to fewer colors. # This could possibly happen if we requantize to fewer colors.
# The transparency would be totally off in that case. # The transparency would be totally off in that case.
del(new.info['transparency']) del new.info['transparency']
if trns is not None: if trns is not None:
try: try:
new.info['transparency'] = new.palette.getcolor(trns) new.info['transparency'] = new.palette.getcolor(trns)
except Exception: except Exception:
# if we can't make a transparent color, don't leave the old # if we can't make a transparent color, don't leave the old
# transparency hanging around to mess us up. # transparency hanging around to mess us up.
del(new.info['transparency']) del new.info['transparency']
warnings.warn("Couldn't allocate palette entry " + warnings.warn("Couldn't allocate palette entry " +
"for transparency") "for transparency")
return new return new
@ -1039,13 +1039,13 @@ class Image(object):
new_im = self._new(im) new_im = self._new(im)
if delete_trns: if delete_trns:
# crash fail if we leave a bytes transparency in an rgb/l mode. # crash fail if we leave a bytes transparency in an rgb/l mode.
del(new_im.info['transparency']) del new_im.info['transparency']
if trns is not None: if trns is not None:
if new_im.mode == 'P': if new_im.mode == 'P':
try: try:
new_im.info['transparency'] = new_im.palette.getcolor(trns) new_im.info['transparency'] = new_im.palette.getcolor(trns)
except Exception: except Exception:
del(new_im.info['transparency']) del new_im.info['transparency']
warnings.warn("Couldn't allocate palette entry " + warnings.warn("Couldn't allocate palette entry " +
"for transparency") "for transparency")
else: else:

View File

@ -21,7 +21,6 @@ from . import Image
from ._util import isStringType from ._util import isStringType
import operator import operator
import functools import functools
import warnings
# #
@ -523,98 +522,3 @@ def solarize(image, threshold=128):
else: else:
lut.append(255-i) lut.append(255-i)
return _lut(image, lut) return _lut(image, lut)
# --------------------------------------------------------------------
# PIL USM components, from Kevin Cazabon.
def gaussian_blur(im, radius=None):
""" PIL_usm.gblur(im, [radius])"""
warnings.warn(
'PIL.ImageOps.gaussian_blur is deprecated. '
'Use PIL.ImageFilter.GaussianBlur instead. '
'This function will be removed in a future version.',
DeprecationWarning
)
if radius is None:
radius = 5.0
im.load()
return im.im.gaussian_blur(radius)
def gblur(im, radius=None):
""" PIL_usm.gblur(im, [radius])"""
warnings.warn(
'PIL.ImageOps.gblur is deprecated. '
'Use PIL.ImageFilter.GaussianBlur instead. '
'This function will be removed in a future version.',
DeprecationWarning
)
return gaussian_blur(im, radius)
def unsharp_mask(im, radius=None, percent=None, threshold=None):
""" PIL_usm.usm(im, [radius, percent, threshold])"""
warnings.warn(
'PIL.ImageOps.unsharp_mask is deprecated. '
'Use PIL.ImageFilter.UnsharpMask instead. '
'This function will be removed in a future version.',
DeprecationWarning
)
if radius is None:
radius = 5.0
if percent is None:
percent = 150
if threshold is None:
threshold = 3
im.load()
return im.im.unsharp_mask(radius, percent, threshold)
def usm(im, radius=None, percent=None, threshold=None):
""" PIL_usm.usm(im, [radius, percent, threshold])"""
warnings.warn(
'PIL.ImageOps.usm is deprecated. '
'Use PIL.ImageFilter.UnsharpMask instead. '
'This function will be removed in a future version.',
DeprecationWarning
)
return unsharp_mask(im, radius, percent, threshold)
def box_blur(image, radius):
"""
Blur the image by setting each pixel to the average value of the pixels
in a square box extending radius pixels in each direction.
Supports float radius of arbitrary size. Uses an optimized implementation
which runs in linear time relative to the size of the image
for any radius value.
:param image: The image to blur.
:param radius: Size of the box in one direction. Radius 0 does not blur,
returns an identical image. Radius 1 takes 1 pixel
in each direction, i.e. 9 pixels in total.
:return: An image.
"""
warnings.warn(
'PIL.ImageOps.box_blur is deprecated. '
'Use PIL.ImageFilter.BoxBlur instead. '
'This function will be removed in a future version.',
DeprecationWarning
)
image.load()
return image._new(image.im.box_blur(radius))

View File

@ -1,4 +0,0 @@
raise ImportError(
'PIL.OleFileIO is deprecated. Use the olefile Python package '
'instead. This module will be removed in a future version.'
)

View File

@ -6,7 +6,7 @@
[tox] [tox]
envlist = envlist =
lint lint
py{27,34,35,36,37} py{27,35,36,37}
minversion = 1.9 minversion = 1.9
[testenv] [testenv]

View File

@ -258,6 +258,28 @@ copy /Y /B %%LCMS%%\Lib\MS\*.lib %%INCLIB%%
endlocal endlocal
""" % compiler # noqa: E501 """ % compiler # noqa: E501
def build_ghostscript(compiler, bit):
script = r"""
rem Build gs
setlocal
""" + vc_setup(compiler, bit) + r"""
set MSVC_VERSION=""" + {
"2008": "9",
"2015": "14"
}[compiler['vc_version']] + r"""
set RCOMP="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Bin\RC.Exe"
cd /D %%GHOSTSCRIPT%%
"""
if bit == 64:
script += r"""
set WIN64=""
"""
script += r"""
nmake -f psi/msvc.mak
copy /Y /B bin\ C:\Python27\
endlocal
"""
return script % compiler # noqa: E501
def add_compiler(compiler, bit): def add_compiler(compiler, bit):
script.append(setup_compiler(compiler)) script.append(setup_compiler(compiler))
@ -268,6 +290,7 @@ def add_compiler(compiler, bit):
script.append(msbuild_freetype(compiler)) script.append(msbuild_freetype(compiler))
script.append(build_lcms2(compiler)) script.append(build_lcms2(compiler))
# script.append(nmake_openjpeg(compiler)) # script.append(nmake_openjpeg(compiler))
script.append(build_ghostscript(compiler, bit))
script.append(end_compiler()) script.append(end_compiler())
@ -284,7 +307,6 @@ else:
# for compiler in all_compilers(): # for compiler in all_compilers():
# add_compiler(compiler) # add_compiler(compiler)
add_compiler(compilers[7.0][2008][32], 32) add_compiler(compilers[7.0][2008][32], 32)
# add_compiler(compilers[7.1][2010][64])
with open('build_deps.cmd', 'w') as f: with open('build_deps.cmd', 'w') as f:
f.write("\n".join(script)) f.write("\n".join(script))

View File

@ -5,7 +5,6 @@ PILLOW_DEPENDS_DIR = 'C:\\pillow-depends\\'
pythons = {'27': {'compiler': 7, 'vc': 2008}, pythons = {'27': {'compiler': 7, 'vc': 2008},
'pypy2': {'compiler': 7, 'vc': 2008}, 'pypy2': {'compiler': 7, 'vc': 2008},
'34': {'compiler': 7.1, 'vc': 2010},
'35': {'compiler': 7.1, 'vc': 2015}, '35': {'compiler': 7.1, 'vc': 2015},
'36': {'compiler': 7.1, 'vc': 2015}, '36': {'compiler': 7.1, 'vc': 2015},
'37': {'compiler': 7.1, 'vc': 2015}} '37': {'compiler': 7.1, 'vc': 2015}}
@ -43,6 +42,11 @@ libs = {
'filename': PILLOW_DEPENDS_DIR + 'lcms2-2.7.zip', 'filename': PILLOW_DEPENDS_DIR + 'lcms2-2.7.zip',
'dir': 'lcms2-2.7', 'dir': 'lcms2-2.7',
}, },
'ghostscript': {
'url': 'https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs926/ghostscript-9.26.tar.gz', # noqa: E501
'filename': PILLOW_DEPENDS_DIR + 'ghostscript-9.26.tar.gz',
'dir': 'ghostscript-9.26',
},
'tcl-8.5': { 'tcl-8.5': {
'url': SF_MIRROR+'/project/tcl/Tcl/8.5.19/tcl8519-src.zip', 'url': SF_MIRROR+'/project/tcl/Tcl/8.5.19/tcl8519-src.zip',
'filename': PILLOW_DEPENDS_DIR + 'tcl8519-src.zip', 'filename': PILLOW_DEPENDS_DIR + 'tcl8519-src.zip',
@ -66,9 +70,9 @@ libs = {
'version': '8.6.9', 'version': '8.6.9',
}, },
'webp': { 'webp': {
'url': 'http://downloads.webmproject.org/releases/webp/libwebp-1.0.1.tar.gz', 'url': 'http://downloads.webmproject.org/releases/webp/libwebp-1.0.2.tar.gz',
'filename': PILLOW_DEPENDS_DIR + 'libwebp-1.0.1.tar.gz', 'filename': PILLOW_DEPENDS_DIR + 'libwebp-1.0.2.tar.gz',
'dir': 'libwebp-1.0.1', 'dir': 'libwebp-1.0.2',
}, },
'openjpeg': { 'openjpeg': {
'url': SF_MIRROR+'/project/openjpeg/openjpeg/2.3.0/openjpeg-2.3.0.tar.gz', 'url': SF_MIRROR+'/project/openjpeg/openjpeg/2.3.0/openjpeg-2.3.0.tar.gz',
@ -99,24 +103,6 @@ compilers = {
} }
}, },
7.1: { 7.1: {
2010: {
64: {
'env_version': 'v7.1',
'vc_version': '2010',
'env_flags': '/x64 /vista',
'inc_dir': 'msvcr10-x64',
'platform': 'x64',
'webp_platform': 'x64',
},
32: {
'env_version': 'v7.1',
'vc_version': '2010',
'env_flags': '/x86 /vista',
'inc_dir': 'msvcr10-x32',
'platform': 'Win32',
'webp_platform': 'x86',
}
},
2015: { 2015: {
64: { 64: {
'env_version': 'v7.1', 'env_version': 'v7.1',