diff --git a/.travis.yml b/.travis.yml index 738b94b71..b4b98e784 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/CHANGES.rst b/CHANGES.rst index f19ae0683..b80639db7 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,7 @@ Changelog (Pillow) ================== -2.5.0 (unreleased) +2.5.0 (2014-07-01) ------------------ - Imagedraw rewrite diff --git a/PIL/Jpeg2KImagePlugin.py b/PIL/Jpeg2KImagePlugin.py index 66069802e..0a7a6e297 100644 --- a/PIL/Jpeg2KImagePlugin.py +++ b/PIL/Jpeg2KImagePlugin.py @@ -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 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 diff --git a/Scripts/diffcover-install.sh b/Scripts/diffcover-install.sh new file mode 100755 index 000000000..93e06efe3 --- /dev/null +++ b/Scripts/diffcover-install.sh @@ -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 diff --git a/Scripts/diffcover-run.sh b/Scripts/diffcover-run.sh new file mode 100755 index 000000000..02efab6ae --- /dev/null +++ b/Scripts/diffcover-run.sh @@ -0,0 +1,4 @@ +coverage xml +diff-cover coverage.xml +diff-quality --violation=pyflakes +diff-quality --violation=pep8 diff --git a/Tests/test_file_jpeg2k.py b/Tests/test_file_jpeg2k.py index b763687f7..23564c434 100644 --- a/Tests/test_file_jpeg2k.py +++ b/Tests/test_file_jpeg2k.py @@ -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) diff --git a/docs/_templates/sidebarhelp.html b/docs/_templates/sidebarhelp.html index ce36d2e34..e07180a99 100644 --- a/docs/_templates/sidebarhelp.html +++ b/docs/_templates/sidebarhelp.html @@ -1,18 +1,4 @@
- You can seek realtime assistance via IRC at - irc://irc.freenode.net#pil. You can - also post to the - - Image-SIG mailing list. And, of course, there's - - Stack Overflow. + You can get help via IRC at irc://irc.freenode.net#pil or Stack Overflow here and here. Please report issues on GitHub.
- -- If you've discovered a bug, you can - open an issue - on Github. -
- diff --git a/docs/about.rst b/docs/about.rst index 817773610..919b2918c 100644 --- a/docs/about.rst +++ b/docs/about.rst @@ -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 ------- diff --git a/docs/index.rst b/docs/index.rst index a8c204228..16e450856 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -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