From 529ef12f1fb163992b4c787371aa25acd6b487a3 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 14 Jul 2014 21:02:12 -0700 Subject: [PATCH 1/9] Doc targets + help for makefile --- Makefile | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3dcfe8d13..98e0c647a 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,16 @@ +.PHONY: pre clean install test inplace coverage test-dep help docs livedocs +help: + @echo "Please use \`make ' where is one of" + @echo " html to make standalone HTML files" + @echo " clean remove build products" + @echo " install make and install" + @echo " test run tests on installed pillow" + @echo " inplace make inplace extension" + @echo " coverage run coverage test (in progress)" + @echo " docs make html docs" + @echo " docserver run an http server on the docs directory" + @echo " test-dep install coveraget and test dependencies" pre: virtualenv . @@ -18,12 +30,11 @@ clean: rm -r build || true find . -name __pycache__ | xargs rm -r || true - install: python setup.py install python selftest.py --installed -test: install +test: python test-installed.py inplace: clean @@ -42,3 +53,9 @@ coverage: test-dep: pip install coveralls nose nose-cov pep8 pyflakes + +docs: + $(MAKE) -C docs html + +docserver: + cd docs/_build/html && python -mSimpleHTTPServer 2> /dev/null& \ No newline at end of file From a0cfa466d96fff20feb204f623770bbd3a049083 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 14 Jul 2014 21:11:00 -0700 Subject: [PATCH 2/9] Fixing warnings when building docs --- PIL/ImageCms.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PIL/ImageCms.py b/PIL/ImageCms.py index fc176952e..c62bffee2 100644 --- a/PIL/ImageCms.py +++ b/PIL/ImageCms.py @@ -637,7 +637,7 @@ def getProfileName(profile): (pyCMS) Gets the internal product name for the given profile. - If profile isn't a valid CmsProfile object or filename to a profile, + If profile isn't a valid CmsProfile object or filename to a profile, a PyCMSError is raised If an error occurs while trying to obtain the name tag, a PyCMSError is raised. @@ -876,7 +876,7 @@ def isIntentSupported(profile, intent, direction): input/output/proof profile as you desire. Some profiles are created specifically for one "direction", can cannot - be used for others. Some profiles can only be used for certain + be used for others. Some profiles can only be used for certain rendering intents... so it's best to either verify this before trying to create a transform with them (using this function), or catch the potential PyCMSError that will occur if they don't support the modes From d80eef46ce8e07333d80e10a6f9730b22bdf5728 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 14 Jul 2014 21:13:01 -0700 Subject: [PATCH 3/9] Fixing warnings when building docs --- docs/PIL.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/PIL.rst b/docs/PIL.rst index 3b4706511..07d45810e 100644 --- a/docs/PIL.rst +++ b/docs/PIL.rst @@ -61,6 +61,7 @@ can be found here. :show-inheritance: .. intentionally skipped documenting this because it's not documented anywhere + :mod:`ImageDraw2` Module ------------------------ @@ -70,6 +71,7 @@ can be found here. :show-inheritance: .. intentionally skipped documenting this because it's deprecated + :mod:`ImageFileIO` Module ------------------------- From a0d6cf01ce275d66fa26de7c8ea7743a18011219 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 14 Jul 2014 21:24:54 -0700 Subject: [PATCH 4/9] Fixing doc warnings, reformatting docstring comments --- PIL/OleFileIO.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/PIL/OleFileIO.py b/PIL/OleFileIO.py index 8a3c77be4..e5ecc6e56 100644 --- a/PIL/OleFileIO.py +++ b/PIL/OleFileIO.py @@ -15,8 +15,11 @@ Improved version of the OleFileIO module from PIL library v1.1.6 See: http://www.pythonware.com/products/pil/index.htm The Python Imaging Library (PIL) is + Copyright (c) 1997-2005 by Secret Labs AB + Copyright (c) 1995-2005 by Fredrik Lundh + OleFileIO_PL changes are Copyright (c) 2005-2014 by Philippe Lagadec See source code and LICENSE.txt for information on usage and redistribution. @@ -1701,10 +1704,12 @@ class OleFileIO: Open a stream as a read-only file object (BytesIO). filename: path of stream in storage tree (except root entry), either: + - a string using Unix path syntax, for example: 'storage_1/storage_1.2/stream' - a list of storage filenames, path to the desired stream/storage. Example: ['storage_1', 'storage_1.2', 'stream'] + return: file object (read-only) raise IOError if filename not found, or if this is not a stream. """ @@ -1722,6 +1727,7 @@ class OleFileIO: filename: path of stream in storage tree. (see openstream for syntax) return: False if object does not exist, its entry type (>0) otherwise: + - STGTY_STREAM: a stream - STGTY_STORAGE: a storage - STGTY_ROOT: the root entry @@ -1812,7 +1818,7 @@ class OleFileIO: filename: path of stream in storage tree (see openstream for syntax) convert_time: bool, if True timestamps will be converted to Python datetime no_conversion: None or list of int, timestamps not to be converted - (for example total editing time is not a real timestamp) + (for example total editing time is not a real timestamp) return: a dictionary of values indexed by id (integer) """ # make sure no_conversion is a list, just to simplify code below: From 5e12c490343457e16109edacd87f3e39020e26c8 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 14 Jul 2014 21:32:14 -0700 Subject: [PATCH 5/9] Fixing doc warning --- PIL/PSDraw.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/PIL/PSDraw.py b/PIL/PSDraw.py index 88593bb9d..26fdb74ea 100644 --- a/PIL/PSDraw.py +++ b/PIL/PSDraw.py @@ -73,9 +73,8 @@ class PSDraw: def setink(self, ink): """ - .. warning:: + .. warning:: This has been in the PIL API for ages but was never implemented. - This has been in the PIL API for ages but was never implemented. """ print("*** NOT YET IMPLEMENTED ***") From 551cdedb45d890a42850a78d2a1d6bae98b5da7c Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 14 Jul 2014 21:57:58 -0700 Subject: [PATCH 6/9] Pulled ImageCms into it's own docpage --- docs/PIL.rst | 8 -------- docs/reference/ImageCms.rst | 13 +++++++++++++ docs/reference/index.rst | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) create mode 100644 docs/reference/ImageCms.rst diff --git a/docs/PIL.rst b/docs/PIL.rst index 07d45810e..537b2fd8f 100644 --- a/docs/PIL.rst +++ b/docs/PIL.rst @@ -52,14 +52,6 @@ can be found here. :undoc-members: :show-inheritance: -:mod:`ImageCms` Module ----------------------- - -.. automodule:: PIL.ImageCms - :members: - :undoc-members: - :show-inheritance: - .. intentionally skipped documenting this because it's not documented anywhere :mod:`ImageDraw2` Module diff --git a/docs/reference/ImageCms.rst b/docs/reference/ImageCms.rst new file mode 100644 index 000000000..2d5bb1388 --- /dev/null +++ b/docs/reference/ImageCms.rst @@ -0,0 +1,13 @@ +.. py:module:: PIL.ImageCms +.. py:currentmodule:: PIL.ImageCms + +:py:mod:`ImageCms` Module +========================= + +The :py:mod:`ImageCms` module provides color profile management +support using the LittleCMS2 color management engine, based on Kevin +Cazabon's PyCMS library. + +.. automodule:: PIL.ImageCms + :members: + :noindex: diff --git a/docs/reference/index.rst b/docs/reference/index.rst index 66310e3e7..fca2b387b 100644 --- a/docs/reference/index.rst +++ b/docs/reference/index.rst @@ -8,6 +8,7 @@ Reference Image ImageChops ImageColor + ImageCms ImageDraw ImageEnhance ImageFile From 6a928ff6e2bd66cfb14089f9755a272765a42f76 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 14 Jul 2014 21:59:42 -0700 Subject: [PATCH 7/9] Removed leading docstring --- PIL/ImageCms.py | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/PIL/ImageCms.py b/PIL/ImageCms.py index c62bffee2..456bcbb96 100644 --- a/PIL/ImageCms.py +++ b/PIL/ImageCms.py @@ -1,19 +1,18 @@ -""" -The Python Imaging Library. -$Id$ +## The Python Imaging Library. +## $Id$ -Optional color managment support, based on Kevin Cazabon's PyCMS -library. +## Optional color managment support, based on Kevin Cazabon's PyCMS +## library. -History: -2009-03-08 fl Added to PIL. +## History: -Copyright (C) 2002-2003 Kevin Cazabon -Copyright (c) 2009 by Fredrik Lundh +## 2009-03-08 fl Added to PIL. -See the README file for information on usage and redistribution. See -below for the original description. -""" +## Copyright (C) 2002-2003 Kevin Cazabon +## Copyright (c) 2009 by Fredrik Lundh + +## See the README file for information on usage and redistribution. See +## below for the original description. from __future__ import print_function From 5eef39f3fb93635d4aaf55d593d0bb683d21366e Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 14 Jul 2014 22:00:29 -0700 Subject: [PATCH 8/9] Asserting copyright over lcms2 port --- PIL/ImageCms.py | 1 + _imagingcms.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/PIL/ImageCms.py b/PIL/ImageCms.py index 456bcbb96..4ea6409d6 100644 --- a/PIL/ImageCms.py +++ b/PIL/ImageCms.py @@ -10,6 +10,7 @@ ## Copyright (C) 2002-2003 Kevin Cazabon ## Copyright (c) 2009 by Fredrik Lundh +## Copyright (c) 2013 by Eric Soroos ## See the README file for information on usage and redistribution. See ## below for the original description. diff --git a/_imagingcms.c b/_imagingcms.c index df26e1a2d..1b7ef49e1 100644 --- a/_imagingcms.c +++ b/_imagingcms.c @@ -6,6 +6,8 @@ * http://www.cazabon.com * Adapted/reworked for PIL by Fredrik Lundh * Copyright (c) 2009 Fredrik Lundh + * Updated to LCMS2 + * Copyright (c) 2013 Eric Soroos * * pyCMS home page: http://www.cazabon.com/pyCMS * littleCMS home page: http://www.littlecms.com From 4a5d73cb1e1dbc0e781d03d24e62f31d73f14291 Mon Sep 17 00:00:00 2001 From: wiredfool Date: Mon, 14 Jul 2014 22:25:02 -0700 Subject: [PATCH 9/9] Fixing errors when compiling docs --- docs/reference/Image.rst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/reference/Image.rst b/docs/reference/Image.rst index bf64c835d..11666dd0b 100644 --- a/docs/reference/Image.rst +++ b/docs/reference/Image.rst @@ -49,7 +49,10 @@ Functions .. autofunction:: open - .. warning:: > To protect against potential DOS attacks caused by "`decompression bombs`_" (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`_ to have warnings output to the logging facility instead of stderr. + .. warning:: To protect against potential DOS attacks caused by "`decompression bombs`_" (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`_ to have warnings output to the logging facility instead of stderr. + + .. _decompression bombs: https://en.wikipedia.org/wiki/Zip_bomb + .. _the logging documentation: https://docs.python.org/2/library/logging.html?highlight=logging#integration-with-the-warnings-module Image processing ^^^^^^^^^^^^^^^^