Merge from master

This commit is contained in:
wiredfool 2014-07-05 11:02:13 -07:00
commit a414986ee9
11 changed files with 58 additions and 88 deletions

View File

@ -3,7 +3,7 @@ language: python
notifications:
irc: "chat.freenode.net#pil"
env: MAX_CONCURRENCY=4 NOSE_PROCESSES=4 NOSE_PROCESS_TIMEOUT=30
env: MAX_CONCURRENCY=4
python:
- "pypy"
@ -14,9 +14,9 @@ python:
- 3.4
install:
- "sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-qt4 ghostscript libffi-dev cmake imagemagick"
- "sudo apt-get -qq install libfreetype6-dev liblcms2-dev python-qt4 ghostscript libffi-dev libjpeg-turbo-progs cmake imagemagick"
- "pip install cffi"
- "pip install coveralls nose pyroma nose-cov"
- "pip install coveralls nose pyroma"
- if [ "$TRAVIS_PYTHON_VERSION" == "2.6" ]; then pip install unittest2; fi
# webp
@ -35,17 +35,22 @@ script:
- if [ "$TRAVIS_PYTHON_VERSION" == "pypy" ]; then time nosetests Tests/test_*.py; fi
# Cover the others
- if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then coverage run --parallel-mode --include=PIL/* selftest.py; fi
# write html report, then ignore. Coverage needs to be combined first
- if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then nosetests --with-cov --cov='PIL/' --cov-report=html Tests/test_*.py; fi
- if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then time coverage run --append --include=PIL/* selftest.py; fi
- if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then time coverage run --append --include=PIL/* -m nose Tests/test_*.py; fi
after_success:
- ls -l .coverage*
- coverage combine
- coverage report
- coveralls
# No need to send empty coverage to Coveralls for PyPy
- if [ "$TRAVIS_PYTHON_VERSION" != "pypy" ]; then coveralls; fi
- pip install pep8 pyflakes
- pep8 --statistics --count PIL/*.py
- pep8 --statistics --count Tests/*.py
- pyflakes PIL/*.py | tee >(wc -l)
- pyflakes Tests/*.py | tee >(wc -l)
# Coverage and quality reports on just the latest diff.
# (Installation is very slow on Py3, so just do it for Py2.)
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then Scripts/diffcover-install.sh; fi
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then Scripts/diffcover-run.sh; fi

View File

@ -1,7 +1,7 @@
Changelog (Pillow)
==================
2.5.0 (unreleased)
2.5.0 (2014-07-01)
------------------
- Imagedraw rewrite

View File

@ -172,18 +172,16 @@ class Jpeg2KImageFile(ImageFile.ImageFile):
fd = -1
length = -1
if hasattr(self.fp, "fileno"):
try:
fd = self.fp.fileno()
length = os.fstat(fd).st_size
except:
fd = -1
elif hasattr(self.fp, "seek"):
try:
pos = f.tell()
f.seek(0, 2)
length = f.tell()
f.seek(pos, 0)
pos = self.fp.tell()
self.fp.seek(0, 2)
length = self.fp.tell()
self.fp.seek(pos, 0)
except:
length = -1

7
Scripts/diffcover-install.sh Executable file
View File

@ -0,0 +1,7 @@
# Fetch the remote master branch before running diff-cover on Travis CI.
# https://github.com/edx/diff-cover#troubleshooting
git fetch origin master:refs/remotes/origin/master
# CFLAGS=-O0 means build with no optimisation.
# Makes build much quicker for lxml and other dependencies.
time CFLAGS=-O0 pip install --use-wheel diff_cover

4
Scripts/diffcover-run.sh Executable file
View File

@ -0,0 +1,4 @@
coverage xml
diff-cover coverage.xml
diff-quality --violation=pyflakes
diff-quality --violation=pep8

View File

@ -39,6 +39,13 @@ class TestFileJpeg2k(PillowTestCase):
self.assertEqual(im.size, (640, 480))
self.assertEqual(im.format, 'JPEG2000')
def test_bytesio(self):
with open('Tests/images/test-card-lossless.jp2', 'rb') as f:
data = BytesIO(f.read())
im = Image.open(data)
im.load()
self.assert_image_similar(im, test_card, 1.0e-3)
# These two test pre-written JPEG 2000 files that were not written with
# PIL (they were made using Adobe Photoshop)

View File

@ -1,18 +1,4 @@
<h3>Need help?</h3>
<p>
You can seek realtime assistance via IRC at
<a href="irc://irc.freenode.net#pil">irc://irc.freenode.net#pil</a>. You can
also post to the
<a href="http://mail.python.org/mailman/listinfo/image-sig">
Image-SIG mailing list</a>. And, of course, there's
<a href="http://stackoverflow.com/questions/tagged/pillow">
Stack Overflow</a>.
You can get help via IRC at <a href="irc://irc.freenode.net#pil">irc://irc.freenode.net#pil</a> or Stack Overflow <a href="http://stackoverflow.com/questions/tagged/pillow">here</a> and <a href="http://stackoverflow.com/questions/tagged/pil">here</a>. Please <a href="https://github.com/python-pillow/Pillow/issues/new">report issues on GitHub</a>.
</p>
<p>
If you've discovered a bug, you can
<a href="https://github.com/python-pillow/Pillow/issues/new">open an issue
on Github</a>.
</p>

View File

@ -9,12 +9,10 @@ The fork authors' goal is to foster active development of PIL through:
- Continuous integration testing via `Travis CI`_
- Publicized development activity on `GitHub`_
- Regular releases to the `Python Package Index`_
- Solicitation for community contributions and involvement on `Image-SIG`_
.. _Travis CI: https://travis-ci.org/python-pillow/Pillow
.. _GitHub: https://github.com/python-pillow/Pillow
.. _Python Package Index: https://pypi.python.org/pypi/Pillow
.. _Image-SIG: http://mail.python.org/mailman/listinfo/image-sig
License
-------

View File

@ -1,8 +1,7 @@
Pillow
======
Pillow is the 'friendly' PIL fork by Alex Clark and Contributors. PIL is the
Python Imaging Library by Fredrik Lundh and Contributors.
Pillow is the 'friendly' PIL fork by Alex Clark and Contributors. PIL is the Python Imaging Library by Fredrik Lundh and Contributors.
.. image:: https://travis-ci.org/python-pillow/Pillow.svg?branch=master
:target: https://travis-ci.org/python-pillow/Pillow
@ -20,12 +19,7 @@ Python Imaging Library by Fredrik Lundh and Contributors.
:target: https://coveralls.io/r/python-pillow/Pillow?branch=master
:alt: Test coverage
To start using Pillow, please read the :doc:`installation
instructions <installation>`.
You can get the source and contribute at
https://github.com/python-pillow/Pillow. You can download archives
and old versions from `PyPI <https://pypi.python.org/pypi/Pillow>`_.
To install Pillow, please follow the :doc:`installation instructions <installation>`. To download source and/or contribute to development of Pillow please see: https://github.com/python-pillow/Pillow.
.. toctree::
:maxdepth: 2
@ -37,30 +31,6 @@ and old versions from `PyPI <https://pypi.python.org/pypi/Pillow>`_.
handbook/appendices
original-readme
Support Pillow!
===============
PIL needs you! Please help us maintain the Python Imaging Library here:
- `GitHub <https://github.com/python-pillow/Pillow>`_
- `Freenode <irc://irc.freenode.net#pil>`_
- `Image-SIG <http://mail.python.org/mailman/listinfo/image-sig>`_
Financial
---------
Pillow is a volunteer effort led by Alex Clark. If you can't help with
development please consider helping us financially. Your assistance would
be very much appreciated!
.. note:: Contributors please add your name and donation preference here.
======================================= =======================================
**Developer** **Preference**
======================================= =======================================
Alex Clark (fork author) http://gittip.com/aclark4life
======================================= =======================================
Indices and tables
==================

View File

@ -44,6 +44,10 @@ run::
External libraries
------------------
.. note::
You *do not* need to install all of the external libraries to use Pillow's basic features.
Many of Pillow's features require external libraries:
* **libjpeg** provides JPEG functionality.
@ -92,11 +96,6 @@ Linux installation
Fedora, Debian/Ubuntu, and ArchLinux include Pillow (instead of PIL) with
their distributions. Consider using those instead of installing manually.
.. note::
You *do not* need to install all of the external libraries to get Pillow's
basics to work.
**We do not provide binaries for Linux.** If you didn't build Python from
source, make sure you have Python's development libraries installed. In Debian
or Ubuntu::
@ -131,22 +130,13 @@ Prerequisites are installed on **Fedora 20** with::
Mac OS X installation
---------------------
.. note::
We provide binaries for OS X in the form of `Python Wheels <http://wheel.readthedocs.org/en/latest/index.html>`_. Alternatively you can compile Pillow with with XCode.
You *do not* need to install all of the external libraries to get Pillow's
basics to work.
**We do not provide binaries for OS X**, so you'll need XCode to install
Pillow. (XCode 4.2 on 10.6 will work with the Official Python binary
distribution. Otherwise, use whatever XCode you used to compile Python.)
The easiest way to install the prerequisites is via `Homebrew
<http://mxcl.github.com/homebrew/>`_. After you install Homebrew, run::
The easiest way to install external libraries is via `Homebrew <http://mxcl.github.com/homebrew/>`_. After you install Homebrew, run::
$ brew install libtiff libjpeg webp little-cms2
If you've built your own Python, then you should be able to install Pillow
using::
Install Pillow with::
$ pip install Pillow
@ -253,3 +243,8 @@ current versions of Linux, OS X, and Windows.
+----------------------------------+-------------+------------------------------+------------------------------+-----------------------+
| Windows 8.1 Pro |Yes | 2.6,2.7,3.2,3.3,3.4 | 2.3.0, 2.4.0 |x86,x86-64 |
+----------------------------------+-------------+------------------------------+------------------------------+-----------------------+
Old Versions
------------
You can download old distributions from `PyPI <https://pypi.python.org/pypi/Pillow>`_. Only the latest 1.x and 2.x releases are visible, but all releases are available by direct URL access e.g. https://pypi.python.org/pypi/Pillow/1.0.

View File

@ -49,7 +49,7 @@ Functions
.. autofunction:: open
.. warning:: > To protect against potential DOS attacks caused by "[decompression bombs](https://en.wikipedia.org/wiki/Zip_bomb)" (i.e. malicious files which decompress into a huge amount of data and are designed to crash or cause disruption by using up a lot of memory), Pillow will issue a `DecompressionBombWarning` if the image is over a certain limit. If desired, the warning can be turned into an error with `warnings.simplefilter('error', Image.DecompressionBombWarning)` or suppressed entirely with `warnings.simplefilter('ignore', Image.DecompressionBombWarning)`. See also [the logging documentation](https://docs.python.org/2/library/logging.html?highlight=logging#integration-with-the-warnings-module) to have warnings output to the logging facility instead of stderr.
.. warning:: > To protect against potential DOS attacks caused by "`decompression bombs<https://en.wikipedia.org/wiki/Zip_bomb>`_" (i.e. malicious files which decompress into a huge amount of data and are designed to crash or cause disruption by using up a lot of memory), Pillow will issue a `DecompressionBombWarning` if the image is over a certain limit. If desired, the warning can be turned into an error with `warnings.simplefilter('error', Image.DecompressionBombWarning)` or suppressed entirely with `warnings.simplefilter('ignore', Image.DecompressionBombWarning)`. See also `the logging documentation<https://docs.python.org/2/library/logging.html?highlight=logging#integration-with-the-warnings-module>`_ to have warnings output to the logging facility instead of stderr.
Image processing
^^^^^^^^^^^^^^^^