Message ID | 20250507115001.3365087-1-leon.anavi@konsulko.com |
---|---|
State | Superseded |
Headers | show |
Series | [meta-python] python3-pillow-heif: Add recipe | expand |
On Wed, May 7, 2025 at 4:50 AM Leon Anavi via lists.openembedded.org <leon.anavi=konsulko.com@lists.openembedded.org> wrote: > > Add recipe for release 0.22.0: > > - Boolean pillow_heif.options.DISABLE_SECURITY_LIMITS to bypass > security limit of libheif for the image size. > - libx265 library was updated to the latest 4.1 version. > - libheif was updated from the 1.19.5 to 1.19.7 version. > - AVIF format marked as deprecated and pending for the removal. > > This work was sponsored by GOVCERT.LU. > > Signed-off-by: Leon Anavi <leon.anavi@konsulko.com> > --- > ...001-setup.py-support-cross-compiling.patch | 56 +++++++++++++++++++ > .../python/python3-pillow-heif_0.22.0.bb | 17 ++++++ > 2 files changed, 73 insertions(+) > create mode 100644 meta-python/recipes-devtools/python/python3-pillow-heif/0001-setup.py-support-cross-compiling.patch > create mode 100644 meta-python/recipes-devtools/python/python3-pillow-heif_0.22.0.bb > > diff --git a/meta-python/recipes-devtools/python/python3-pillow-heif/0001-setup.py-support-cross-compiling.patch b/meta-python/recipes-devtools/python/python3-pillow-heif/0001-setup.py-support-cross-compiling.patch > new file mode 100644 > index 0000000000..66cf7a9244 > --- /dev/null > +++ b/meta-python/recipes-devtools/python/python3-pillow-heif/0001-setup.py-support-cross-compiling.patch > @@ -0,0 +1,56 @@ > +From 98e6831754712221ce030ce8b27e100a3926c543 Mon Sep 17 00:00:00 2001 > +From: Leon Anavi <leon.anavi@konsulko.com> > +Date: Mon, 5 May 2025 16:08:37 +0000 > +Subject: [PATCH] setup.py: support cross compiling > + > +Upstream-Status: Inappropriate [oe specific] > + > +Signed-off-by: Leon Anavi <leon.anavi@konsulko.com> > +--- > + setup.py | 19 +++++++++++-------- > + 1 file changed, 11 insertions(+), 8 deletions(-) > + > +diff --git a/setup.py b/setup.py > +index 68945e4..67566e8 100644 > +--- a/setup.py > ++++ b/setup.py > +@@ -125,12 +125,12 @@ class PillowHeifBuildExt(build_ext): > + self._add_directory(library_dirs, match.group(1)) > + > + # include, rpath, if set as environment variables > +- for k in ("C_INCLUDE_PATH", "CPATH", "INCLUDE"): > ++ for k in ("C_INCLUDE_PATH", "CPATH", "INCLUDE", "STAGING_INCDIR"): > + if k in os.environ: > + for d in os.environ[k].split(os.path.pathsep): > + self._add_directory(include_dirs, d) > + > +- for k in ("LD_RUN_PATH", "LIBRARY_PATH", "LIB"): > ++ for k in ("LD_RUN_PATH", "LIBRARY_PATH", "LIB", "STAGING_LIBDIR"): > + if k in os.environ: > + for d in os.environ[k].split(os.path.pathsep): > + self._add_directory(library_dirs, d) > +@@ -199,12 +199,15 @@ class PillowHeifBuildExt(build_ext): > + self._update_extension("_pillow_heif", ["heif"], extra_compile_args=["-O3", "-Werror"]) > + else: # let's assume it's some kind of linux > + # this old code waiting for refactoring, when time comes. > +- self._add_directory(include_dirs, "/usr/local/include") > +- self._add_directory(include_dirs, "/usr/include") > +- self._add_directory(library_dirs, "/usr/local/lib") > +- self._add_directory(library_dirs, "/usr/lib64") > +- self._add_directory(library_dirs, "/usr/lib") > +- self._add_directory(library_dirs, "/lib") > ++ include_os_path = os.environ.get("STAGING_INCDIR") > ++ if include_os_path: > ++ for path in include_os_path.split(os.pathsep): > ++ self._add_directory(include_dirs, path) > ++ > ++ lib_os_path = os.environ.get("STAGING_LIBDIR") > ++ if lib_os_path: > ++ for path in lib_os_path.split(os.pathsep): > ++ self._add_directory(library_dirs, path) > + > + self._update_extension("_pillow_heif", ["heif"], extra_compile_args=["-O3", "-Werror"]) > + > +-- > +2.39.5 > + > diff --git a/meta-python/recipes-devtools/python/python3-pillow-heif_0.22.0.bb b/meta-python/recipes-devtools/python/python3-pillow-heif_0.22.0.bb > new file mode 100644 > index 0000000000..34eaab92b9 > --- /dev/null > +++ b/meta-python/recipes-devtools/python/python3-pillow-heif_0.22.0.bb > @@ -0,0 +1,17 @@ > +DESCRIPTION = "Python interface for libheif library" > +HOMEPAGE = "https://github.com/bigcat88/pillow_heif" > +LICENSE = "BSD-3-Clause" > +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=b6c07a92aed67c33bc346748d7c7e991" > + > +PYPI_PACKAGE = "pillow_heif" > + > +inherit pypi python_setuptools_build_meta > + > +SRC_URI += "file://0001-setup.py-support-cross-compiling.patch" > +SRC_URI[sha256sum] = "61d473929340d3073722f6316b7fbbdb11132faa6bac0242328e8436cc55b39a" > + > +DEPENDS += "libheif" libheif has a commercial license and I think we should reflect that here as well. Otherwise, it will be trying to build it but it will not if the user's distro does not enable this license. > + > +RDEPENDS:${PN} += "python3-pillow" > + > +BBCLASSEXTEND = "native nativesdk" > -- > 2.39.5 > > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#117358): https://lists.openembedded.org/g/openembedded-devel/message/117358 > Mute This Topic: https://lists.openembedded.org/mt/112666250/1997914 > Group Owner: openembedded-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
Hi Khem, On 7.05.25 г. 21:34 ч., Khem Raj wrote: > libheif has a commercial license and I think we should reflect that > here as well. Otherwise, it will be trying to build it > but it will not if the user's distro does not enable this license. Good point, thank you for the code review. I have just sent v2 of the patch. Best regards, Leon
diff --git a/meta-python/recipes-devtools/python/python3-pillow-heif/0001-setup.py-support-cross-compiling.patch b/meta-python/recipes-devtools/python/python3-pillow-heif/0001-setup.py-support-cross-compiling.patch new file mode 100644 index 0000000000..66cf7a9244 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-pillow-heif/0001-setup.py-support-cross-compiling.patch @@ -0,0 +1,56 @@ +From 98e6831754712221ce030ce8b27e100a3926c543 Mon Sep 17 00:00:00 2001 +From: Leon Anavi <leon.anavi@konsulko.com> +Date: Mon, 5 May 2025 16:08:37 +0000 +Subject: [PATCH] setup.py: support cross compiling + +Upstream-Status: Inappropriate [oe specific] + +Signed-off-by: Leon Anavi <leon.anavi@konsulko.com> +--- + setup.py | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +diff --git a/setup.py b/setup.py +index 68945e4..67566e8 100644 +--- a/setup.py ++++ b/setup.py +@@ -125,12 +125,12 @@ class PillowHeifBuildExt(build_ext): + self._add_directory(library_dirs, match.group(1)) + + # include, rpath, if set as environment variables +- for k in ("C_INCLUDE_PATH", "CPATH", "INCLUDE"): ++ for k in ("C_INCLUDE_PATH", "CPATH", "INCLUDE", "STAGING_INCDIR"): + if k in os.environ: + for d in os.environ[k].split(os.path.pathsep): + self._add_directory(include_dirs, d) + +- for k in ("LD_RUN_PATH", "LIBRARY_PATH", "LIB"): ++ for k in ("LD_RUN_PATH", "LIBRARY_PATH", "LIB", "STAGING_LIBDIR"): + if k in os.environ: + for d in os.environ[k].split(os.path.pathsep): + self._add_directory(library_dirs, d) +@@ -199,12 +199,15 @@ class PillowHeifBuildExt(build_ext): + self._update_extension("_pillow_heif", ["heif"], extra_compile_args=["-O3", "-Werror"]) + else: # let's assume it's some kind of linux + # this old code waiting for refactoring, when time comes. +- self._add_directory(include_dirs, "/usr/local/include") +- self._add_directory(include_dirs, "/usr/include") +- self._add_directory(library_dirs, "/usr/local/lib") +- self._add_directory(library_dirs, "/usr/lib64") +- self._add_directory(library_dirs, "/usr/lib") +- self._add_directory(library_dirs, "/lib") ++ include_os_path = os.environ.get("STAGING_INCDIR") ++ if include_os_path: ++ for path in include_os_path.split(os.pathsep): ++ self._add_directory(include_dirs, path) ++ ++ lib_os_path = os.environ.get("STAGING_LIBDIR") ++ if lib_os_path: ++ for path in lib_os_path.split(os.pathsep): ++ self._add_directory(library_dirs, path) + + self._update_extension("_pillow_heif", ["heif"], extra_compile_args=["-O3", "-Werror"]) + +-- +2.39.5 + diff --git a/meta-python/recipes-devtools/python/python3-pillow-heif_0.22.0.bb b/meta-python/recipes-devtools/python/python3-pillow-heif_0.22.0.bb new file mode 100644 index 0000000000..34eaab92b9 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-pillow-heif_0.22.0.bb @@ -0,0 +1,17 @@ +DESCRIPTION = "Python interface for libheif library" +HOMEPAGE = "https://github.com/bigcat88/pillow_heif" +LICENSE = "BSD-3-Clause" +LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=b6c07a92aed67c33bc346748d7c7e991" + +PYPI_PACKAGE = "pillow_heif" + +inherit pypi python_setuptools_build_meta + +SRC_URI += "file://0001-setup.py-support-cross-compiling.patch" +SRC_URI[sha256sum] = "61d473929340d3073722f6316b7fbbdb11132faa6bac0242328e8436cc55b39a" + +DEPENDS += "libheif" + +RDEPENDS:${PN} += "python3-pillow" + +BBCLASSEXTEND = "native nativesdk"
Add recipe for release 0.22.0: - Boolean pillow_heif.options.DISABLE_SECURITY_LIMITS to bypass security limit of libheif for the image size. - libx265 library was updated to the latest 4.1 version. - libheif was updated from the 1.19.5 to 1.19.7 version. - AVIF format marked as deprecated and pending for the removal. This work was sponsored by GOVCERT.LU. Signed-off-by: Leon Anavi <leon.anavi@konsulko.com> --- ...001-setup.py-support-cross-compiling.patch | 56 +++++++++++++++++++ .../python/python3-pillow-heif_0.22.0.bb | 17 ++++++ 2 files changed, 73 insertions(+) create mode 100644 meta-python/recipes-devtools/python/python3-pillow-heif/0001-setup.py-support-cross-compiling.patch create mode 100644 meta-python/recipes-devtools/python/python3-pillow-heif_0.22.0.bb