diff mbox

package/python-pillow: new package

Message ID 1444858103-556-1-git-send-email-angelo.compagnucci@gmail.com
State Superseded
Headers show

Commit Message

Angelo Compagnucci Oct. 14, 2015, 9:28 p.m. UTC
This patch adds python-pillow, the friendly python image library fork.

Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
---
 package/Config.in                      |  1 +
 package/python-pillow/Config.in        | 53 ++++++++++++++++++++++++++++++++++
 package/python-pillow/python-pillow.mk | 36 +++++++++++++++++++++++
 3 files changed, 90 insertions(+)
 create mode 100644 package/python-pillow/Config.in
 create mode 100644 package/python-pillow/python-pillow.mk

Comments

Peter Korsgaard Oct. 19, 2015, 10:02 p.m. UTC | #1
>>>>> "Angelo" == Angelo Compagnucci <angelo.compagnucci@gmail.com> writes:

 > This patch adds python-pillow, the friendly python image library fork.
 > Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>

Thanks, have you tested it with both python 2.7 and 3.x?

> ---
 >  package/Config.in                      |  1 +
 >  package/python-pillow/Config.in        | 53 ++++++++++++++++++++++++++++++++++
 >  package/python-pillow/python-pillow.mk | 36 +++++++++++++++++++++++
 >  3 files changed, 90 insertions(+)
 >  create mode 100644 package/python-pillow/Config.in
 >  create mode 100644 package/python-pillow/python-pillow.mk

 > diff --git a/package/Config.in b/package/Config.in
 > index f686f13..7ba23f0 100644
 > --- a/package/Config.in
 > +++ b/package/Config.in
 > @@ -633,6 +633,7 @@ menu "External python modules"
 >  	source "package/python-nfc/Config.in"
 >  	source "package/python-numpy/Config.in"
 >  	source "package/python-pam/Config.in"
 > +	source "package/python-pillow/Config.in"
 >  	source "package/python-posix-ipc/Config.in"
 >  	source "package/python-protobuf/Config.in"
 >  	source "package/python-psutil/Config.in"
 > diff --git a/package/python-pillow/Config.in b/package/python-pillow/Config.in
 > new file mode 100644
 > index 0000000..7e19aec
 > --- /dev/null
 > +++ b/package/python-pillow/Config.in
 > @@ -0,0 +1,53 @@
 > +config BR2_PACKAGE_PYTHON_PILLOW
 > +	bool "python-pillow"
 > +	help
 > +	  Pillow is the "friendly" PIL fork by Alex Clark and Contributors. PIL is
 > +	  the Python Imaging Library by Fredrik Lundh and Contributors.
 > +
 > +	  https://pypi.python.org/pypi/Pillow/
 > +
 > +if BR2_PACKAGE_PYTHON_PILLOW
 > +
 > +config BR2_PACKAGE_PYTHON_PILLOW_JPEG
 > +	bool "JPEG support"
 > +	select BR2_PACKAGE_JPEG_LIBRARY

The option is simply called BR2_PACKAGE_JPEG.

> +	default n

'n' is the default value of a symbol, so you can drop it here and for
the other options.


> +++ b/package/python-pillow/python-pillow.mk
 > @@ -0,0 +1,36 @@
 > +################################################################################
 > +#
 > +# python-pillow
 > +#
 > +################################################################################
 > +
 > +PYTHON_PILLOW_VERSION = 3.0.0
 > +PYTHON_PILLOW_SITE = $(call github,python-pillow,Pillow,$(PYTHON_PILLOW_VERSION))
 > +PYTHON_PILLOW_DEPENDENCIES = python-setuptools
 > +PYTHON_PILLOW_SETUP_TYPE = distutils

Please also add license info.

> +
 > +ifeq ($(BR2_PACKAGE_PYTHON_PILLOW_JPEG),y)
 > +PYTHON_PILLOW_DEPENDENCIES += jpeg

Is there no way of disabling support? If so, I think we should get rid
of the explicit Config.in options and just enable support for the
libraries that are enabled in the buildroot configuration, as it will
add jpeg support if you have libjpeg enabled no matter if
PYTHON_PILLOW_JPEG is enabled or not (if libjpeg happens to get built
before pillow).

E.G.
PYTHON_PILLOW_DEPENDENCIES = \
      $(if $(BR2_PACKAGE_JPEG),jpeg) \
      $(if $(BR2_PACKAGE_ZLIB),zlib) \
      ..

It unfortunately doesn't build here because it looks in /usr/include for
host headers:

/home/peko/source/buildroot/output-hest/host/usr/bin/arm-linux-gcc -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os -fPIC -DHAVE_LIBJPEG -DHAVE_LIBZ -I/usr/include/freetype2 -I/home/peko/source/buildroot/output-hest/build/python-pillow-3.0.0/libImaging -I/home/peko/source/buildroot/output-hest/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include -I/usr/local/include -I/usr/include -I/home/peko/source/buildroot/output-hest/host/usr/arm-buildroot-linux-uclibcgnueabi/sysroot/usr/include/python3.4m -I/usr/include/x86_64-linux-gnu -c libImaging/UnpackYCC.c -o build/temp.linux-x86_64-3.4/libImaging/UnpackYCC.o
arm-linux-gcc: ERROR: unsafe header/library path used in cross-compilation: '/usr/include/freetype2'
arm-linux-gcc: ERROR: unsafe header/library path used in cross-compilation: '/usr/include/freetype2'
..
arm-linux-gcc: ERROR: unsafe header/library path used in cross-compilation: '/lib64'
error: command '/home/peko/source/buildroot/output-hest/host/usr/bin/arm-linux-gcc' failed with exit status 1
package/pkg-generic.mk:188: recipe for target '/home/peko/source/buildroot/output-hest/build/python-pillow-3.0.0/.stamp_built' failed

Looking at setup.py I see a number of host header/library locations and
host architecture checks, so that won't work for cross compilation.
Thomas Petazzoni Oct. 21, 2015, 9:33 p.m. UTC | #2
Dear Angelo Compagnucci,

On Wed, 14 Oct 2015 23:28:23 +0200, Angelo Compagnucci wrote:
> This patch adds python-pillow, the friendly python image library fork.
> 
> Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
> ---
>  package/Config.in                      |  1 +
>  package/python-pillow/Config.in        | 53 ++++++++++++++++++++++++++++++++++
>  package/python-pillow/python-pillow.mk | 36 +++++++++++++++++++++++
>  3 files changed, 90 insertions(+)
>  create mode 100644 package/python-pillow/Config.in
>  create mode 100644 package/python-pillow/python-pillow.mk

Following Peter Korsgaard's review, I've marked your patch as Changes
Requested since there are a number of issues/comments to be addressed.
Please make sure to send an updated version, otherwise we'll forget
about your patch.

Thanks!

Thomas
diff mbox

Patch

diff --git a/package/Config.in b/package/Config.in
index f686f13..7ba23f0 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -633,6 +633,7 @@  menu "External python modules"
 	source "package/python-nfc/Config.in"
 	source "package/python-numpy/Config.in"
 	source "package/python-pam/Config.in"
+	source "package/python-pillow/Config.in"
 	source "package/python-posix-ipc/Config.in"
 	source "package/python-protobuf/Config.in"
 	source "package/python-psutil/Config.in"
diff --git a/package/python-pillow/Config.in b/package/python-pillow/Config.in
new file mode 100644
index 0000000..7e19aec
--- /dev/null
+++ b/package/python-pillow/Config.in
@@ -0,0 +1,53 @@ 
+config BR2_PACKAGE_PYTHON_PILLOW
+	bool "python-pillow"
+	help
+	  Pillow is the "friendly" PIL fork by Alex Clark and Contributors. PIL is
+	  the Python Imaging Library by Fredrik Lundh and Contributors.
+
+	  https://pypi.python.org/pypi/Pillow/
+
+if BR2_PACKAGE_PYTHON_PILLOW
+
+config BR2_PACKAGE_PYTHON_PILLOW_JPEG
+	bool "JPEG support"
+	select BR2_PACKAGE_JPEG_LIBRARY
+	default n
+	help
+	  This option provides JPEG functionality.
+
+config BR2_PACKAGE_PYTHON_PILLOW_ZLIB
+	bool "compressed PNGs support"
+	select BR2_PACKAGE_ZLIB
+	default n
+	help
+	  This option provides access to compressed PNGs.
+
+config BR2_PACKAGE_PYTHON_PILLOW_TIFF
+	bool "compressed TIFF support"
+	select BR2_PACKAGE_TIFF
+	default n
+	help
+	  This option provides compressed TIFF functionality.
+
+config BR2_PACKAGE_PYTHON_PILLOW_FREETYPE
+	bool "freetype support"
+	select BR2_PACKAGE_FREETYPE
+	default n
+	help
+	  This option provides type related services.
+
+config BR2_PACKAGE_PYTHON_PILLOW_WEBP
+	bool "WebP format support"
+	select BR2_PACKAGE_WEBP
+	default n
+	help
+	  This option provides the WebP format.
+
+config BR2_PACKAGE_PYTHON_PILLOW_JPEG2000
+	bool "JPEG 2000 support"
+	select BR2_PACKAGE_OPENJPEG
+	default n
+	help
+	  This option provides JPEG 2000 functionality.
+
+endif
diff --git a/package/python-pillow/python-pillow.mk b/package/python-pillow/python-pillow.mk
new file mode 100644
index 0000000..94c234e
--- /dev/null
+++ b/package/python-pillow/python-pillow.mk
@@ -0,0 +1,36 @@ 
+################################################################################
+#
+# python-pillow
+#
+################################################################################
+
+PYTHON_PILLOW_VERSION = 3.0.0
+PYTHON_PILLOW_SITE = $(call github,python-pillow,Pillow,$(PYTHON_PILLOW_VERSION))
+PYTHON_PILLOW_DEPENDENCIES = python-setuptools
+PYTHON_PILLOW_SETUP_TYPE = distutils
+
+ifeq ($(BR2_PACKAGE_PYTHON_PILLOW_JPEG),y)
+PYTHON_PILLOW_DEPENDENCIES += jpeg
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON_PILLOW_ZLIB),y)
+PYTHON_PILLOW_DEPENDENCIES += zlib
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON_PILLOW_TIFF),y)
+PYTHON_PILLOW_DEPENDENCIES += tiff
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON_PILLOW_FREETYPE),y)
+PYTHON_PILLOW_DEPENDENCIES += freetype
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON_PILLOW_WEBP),y)
+PYTHON_PILLOW_DEPENDENCIES += webp
+endif
+
+ifeq ($(BR2_PACKAGE_PYTHON_PILLOW_JPEG2000),y)
+PYTHON_PILLOW_DEPENDENCIES += openjpeg
+endif
+
+$(eval $(python-package))