[yocto] Creating a recipe for python3-pillow

Burton, Ross ross.burton at intel.com
Thu Jul 5 03:59:21 PDT 2018


On 5 July 2018 at 08:26, Oliver Westermann <owestermann at gmail.com> wrote:
> I'm fiddeling around with yocto. I want to move some python stuff onto an
> embedded board and use the nxp mx8 yocto. Everything worked as expected
> until now, I was able to create yocto recipes for python modules like pyv4l2
> (is there any interest for recipes like these to be commited to
> meta-python?).
>
> Now I wanted to install pillow for some image manipulation, but whereas
> other python module recipes worked fine, this one fails and I don't
> understand why.
>
> Yocto reports missing setuptools:
>
> Log data follows:
> | DEBUG: Executing shell function do_configure
> | NOTE: make clean
> | python setup.py clean
> | Traceback (most recent call last):
> |   File "setup.py", line 22, in <module>
> |     from setuptools import Extension, setup
> | ImportError: No module named setuptools
>
> I've googled around and everything suggests that inherit setuptools3 is
> missing, but it's present in my recipe. This is my python3-pillow_5.2.0.bb:
>
> SUMMARY = "Pillow (The friendly PIL fork)"
> HOMEPAGE = "http://python-pillow.org/"
> LICENSE = "EPLv1"
> LIC_FILES_CHKSUM = "file://LICENSE;md5=c6379001ecb47e2a0420c40177fc1125"
>
> SRC_URI[md5sum] = "52d93a34f4180abcff04876f23eaa9b9"
>
> PYPI_PACKAGE = "Pillow"
>
> inherit pypi setuptools3
>
> BBCLASSEXTEND = "native nativesdk"
>
> Any idea whats missing or what I am doing wrong (other than that the license
> line is incorrect)?

Oh, that's a fun one.

So setuptools/distutils/etc doesn't have the concept of a "configure"
phase but it also doesn't remove the default implementation.  The
default implementation will try to do a 'make clean' first to remove
existing build artifacts.  Normally this does nothing with Python code
as there's never a Makefile, but pillow has a Makefile.  This makefile
does 'python setup.py clean', which is running the *host* Python2 and
you don't have distutils installed.  So, it fails.

Three solutions in order of hackiness (more to less)
1) Set CLEANBROKEN="1" in the recipe to stop the clean happening
2) Nullify do_configure in the recipe with do_configure[noexec] = "1"
3) Override do_configure in distutils3.bbclass to call setup.py
directly to do a clean in do_configure

I'd say do (1) in your recipe and I'll send a patch for (3) to oe-core.

And yes, this recipe would be very welcome in meta-python.

Ross


More information about the yocto mailing list