From 3569a3b029b2a0b1eb21e24fda24227a6a912aa0 Mon Sep 17 00:00:00 2001 From: Josef Schlehofer Date: Mon, 4 Mar 2019 12:54:30 +0100 Subject: [PATCH] pillow: add Python3 variant and update to 6.1.0 - Add @commodo as maintainer Co-Authored-By: Jeffery To Signed-off-by: Josef Schlehofer --- lang/python/pillow/Makefile | 76 +++++--- .../python/pillow/patches/010-fix-paths.patch | 181 ------------------ 2 files changed, 53 insertions(+), 204 deletions(-) delete mode 100644 lang/python/pillow/patches/010-fix-paths.patch diff --git a/lang/python/pillow/Makefile b/lang/python/pillow/Makefile index feba3f1cb5..e4ffa98641 100644 --- a/lang/python/pillow/Makefile +++ b/lang/python/pillow/Makefile @@ -7,44 +7,74 @@ include $(TOPDIR)/rules.mk PKG_NAME:=pillow -PKG_VERSION:=5.3.0 -PKG_RELEASE:=2 +PKG_VERSION:=6.1.0 +PKG_RELEASE:=1 PKG_SOURCE:=Pillow-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://files.pythonhosted.org/packages/source/P/Pillow -PKG_HASH:=2ea3517cd5779843de8a759c2349a3cd8d3893e03ab47053b66d5ec6f8bc4f93 -PKG_BUILD_DIR:=$(BUILD_DIR)/Pillow-$(PKG_VERSION) -PKG_MAINTAINER:=Alexandru Ardelean +PKG_HASH:=0804f77cb1e9b6dbd37601cee11283bba39a8d44b9ddb053400c58e0c0d7d9de +PKG_BUILD_DIR:=$(BUILD_DIR)/$(BUILD_VARIANT)-Pillow-$(PKG_VERSION) -PKG_LICENSE:=CUSTOM +PKG_MAINTAINER:=Alexandru Ardelean +PKG_LICENSE:=HPND PKG_LICENSE_FILES:=LICENSE PKG_CPE_ID:=cpe:/a:python:pillow include $(INCLUDE_DIR)/package.mk include ../python-package.mk +include ../python3-package.mk + +PKG_UNPACK:=$(HOST_TAR) -C $(PKG_BUILD_DIR) --strip-components=1 -xzf $(DL_DIR)/$(PKG_SOURCE) + +define Package/python-pillow/Default + SUBMENU:=Python + SECTION:=lang + CATEGORY:=Languages + TITLE:=The friendly PIL fork + URL:=https://python-pillow.org/ + DEPENDS:=+libfreetype +libjpeg +libtiff +zlib +endef -define Package/pillow - SUBMENU:=Python - SECTION:=lang - CATEGORY:=Languages - TITLE:=The friendly PIL fork - URL:=https://python-pillow.org/ - DEPENDS:=+python +libfreetype +libjpeg +zlib +libtiff +define Package/python-pillow +$(call Package/python-pillow/Default) + DEPENDS+=+PACKAGE_python-pillow:python + VARIANT:=python endef -define Package/pillow/description - The friendly PIL fork +define Package/python-pillow/description + The friendly PIL fork endef -define Build/Compile - $(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR)) +define Package/python3-pillow +$(call Package/python-pillow/Default) + DEPENDS+=+PACKAGE_python3-pillow:python3 + VARIANT:=python3 endef -define Package/pillow/install - $(INSTALL_DIR) $(1)$(PYTHON_PKG_DIR) - $(CP) \ - $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR)/* \ - $(1)$(PYTHON_PKG_DIR)/ +define Package/python3-pillow/description +$(call Package/python-pillow/description) +. +(Variant for Python3) endef -$(eval $(call BuildPackage,pillow)) +PYTHON3_PKG_SETUP_GLOBAL_ARGS += build_ext \ + --enable-zlib \ + --enable-jpeg \ + --enable-tiff \ + --enable-freetype \ + --disable-lcms \ + --disable-webp \ + --disable-webpmux \ + --disable-jpeg2000 \ + --disable-imagequant \ + --disable-platform-guessing + +PYTHON_PKG_SETUP_GLOBAL_ARGS:=$(PYTHON3_PKG_SETUP_GLOBAL_ARGS) + +$(eval $(call PyPackage,python-pillow)) +$(eval $(call BuildPackage,python-pillow)) +$(eval $(call BuildPackage,python-pillow-src)) + +$(eval $(call Py3Package,python3-pillow)) +$(eval $(call BuildPackage,python3-pillow)) +$(eval $(call BuildPackage,python3-pillow-src)) diff --git a/lang/python/pillow/patches/010-fix-paths.patch b/lang/python/pillow/patches/010-fix-paths.patch deleted file mode 100644 index ca5b2e57dc..0000000000 --- a/lang/python/pillow/patches/010-fix-paths.patch +++ /dev/null @@ -1,181 +0,0 @@ -diff --git a/setup.py b/setup.py -index 15d81e4..ee6dba6 100755 ---- a/setup.py -+++ b/setup.py -@@ -136,12 +136,12 @@ except (ImportError, OSError): - - NAME = 'Pillow' - PILLOW_VERSION = get_version() --JPEG_ROOT = None -+JPEG_ROOT = os.path.join(os.environ['STAGING_DIR'], "/usr/lib") - JPEG2K_ROOT = None --ZLIB_ROOT = None -+ZLIB_ROOT = os.path.join(os.environ['STAGING_DIR'], "/usr/lib") - IMAGEQUANT_ROOT = None --TIFF_ROOT = None --FREETYPE_ROOT = None -+TIFF_ROOT = os.path.join(os.environ['STAGING_DIR'], "/usr/lib") -+FREETYPE_ROOT = os.path.join(os.environ['STAGING_DIR'], "/usr/lib") - LCMS_ROOT = None - - -@@ -289,159 +289,6 @@ class pil_build_ext(build_ext): - _add_directory(library_dirs, os.path.join(prefix, "lib")) - _add_directory(include_dirs, os.path.join(prefix, "include")) - -- # -- # add platform directories -- -- if self.disable_platform_guessing: -- pass -- -- elif sys.platform == "cygwin": -- # pythonX.Y.dll.a is in the /usr/lib/pythonX.Y/config directory -- _add_directory(library_dirs, -- os.path.join("/usr/lib", "python%s" % -- sys.version[:3], "config")) -- -- elif sys.platform == "darwin": -- # attempt to make sure we pick freetype2 over other versions -- _add_directory(include_dirs, "/sw/include/freetype2") -- _add_directory(include_dirs, "/sw/lib/freetype2/include") -- # fink installation directories -- _add_directory(library_dirs, "/sw/lib") -- _add_directory(include_dirs, "/sw/include") -- # darwin ports installation directories -- _add_directory(library_dirs, "/opt/local/lib") -- _add_directory(include_dirs, "/opt/local/include") -- -- # if Homebrew is installed, use its lib and include directories -- try: -- prefix = subprocess.check_output(['brew', '--prefix']).strip( -- ).decode('latin1') -- except Exception: -- # Homebrew not installed -- prefix = None -- -- ft_prefix = None -- -- if prefix: -- # add Homebrew's include and lib directories -- _add_directory(library_dirs, os.path.join(prefix, 'lib')) -- _add_directory(include_dirs, os.path.join(prefix, 'include')) -- ft_prefix = os.path.join(prefix, 'opt', 'freetype') -- -- if ft_prefix and os.path.isdir(ft_prefix): -- # freetype might not be linked into Homebrew's prefix -- _add_directory(library_dirs, os.path.join(ft_prefix, 'lib')) -- _add_directory(include_dirs, -- os.path.join(ft_prefix, 'include')) -- else: -- # fall back to freetype from XQuartz if -- # Homebrew's freetype is missing -- _add_directory(library_dirs, "/usr/X11/lib") -- _add_directory(include_dirs, "/usr/X11/include") -- -- elif sys.platform.startswith("linux"): -- arch_tp = (plat.processor(), plat.architecture()[0]) -- # This should be correct on debian derivatives. -- if os.path.exists('/etc/debian_version'): -- # If this doesn't work, don't just silently patch -- # downstream because it's going to break when people -- # try to build pillow from source instead of -- # installing from the system packages. -- self.add_multiarch_paths() -- -- elif arch_tp == ("x86_64", "32bit"): -- # Special Case: 32-bit build on 64-bit machine. -- _add_directory(library_dirs, "/usr/lib/i386-linux-gnu") -- else: -- libdirs = { -- 'x86_64': ["/lib64", "/usr/lib64", -- "/usr/lib/x86_64-linux-gnu"], -- '64bit': ["/lib64", "/usr/lib64", -- "/usr/lib/x86_64-linux-gnu"], -- 'i386': ["/usr/lib/i386-linux-gnu"], -- 'i686': ["/usr/lib/i386-linux-gnu"], -- '32bit': ["/usr/lib/i386-linux-gnu"], -- 'aarch64': ["/usr/lib64", "/usr/lib/aarch64-linux-gnu"], -- 'arm': ["/usr/lib/arm-linux-gnueabi"], -- 'armv71': ["/usr/lib/arm-linux-gnueabi"], -- 'armv7l': ["/usr/lib"], -- 'ppc64': ["/usr/lib64", "/usr/lib/ppc64-linux-gnu", -- "/usr/lib/powerpc64-linux-gnu"], -- 'ppc64le': ["/usr/lib64"], -- 'ppc': ["/usr/lib/ppc-linux-gnu", -- "/usr/lib/powerpc-linux-gnu"], -- 's390x': ["/usr/lib64", "/usr/lib/s390x-linux-gnu"], -- 's390': ["/usr/lib/s390-linux-gnu"], -- } -- -- for platform_ in arch_tp: -- dirs = libdirs.get(platform_, None) -- if not dirs: -- continue -- for path in dirs: -- _add_directory(library_dirs, path) -- break -- -- else: -- raise ValueError( -- "Unable to identify Linux platform: `%s`" % platform_) -- -- # termux support for android. -- # system libraries (zlib) are installed in /system/lib -- # headers are at $PREFIX/include -- # user libs are at $PREFIX/lib -- if os.environ.get('ANDROID_ROOT', None): -- _add_directory(library_dirs, -- os.path.join(os.environ['ANDROID_ROOT'], -- 'lib')) -- -- elif sys.platform.startswith("gnu"): -- self.add_multiarch_paths() -- -- elif sys.platform.startswith("freebsd"): -- _add_directory(library_dirs, "/usr/local/lib") -- _add_directory(include_dirs, "/usr/local/include") -- -- elif sys.platform.startswith("netbsd"): -- _add_directory(library_dirs, "/usr/pkg/lib") -- _add_directory(include_dirs, "/usr/pkg/include") -- -- elif sys.platform.startswith("sunos5"): -- _add_directory(library_dirs, "/opt/local/lib") -- _add_directory(include_dirs, "/opt/local/include") -- -- # FIXME: check /opt/stuff directories here? -- -- # standard locations -- if not self.disable_platform_guessing: -- _add_directory(library_dirs, "/usr/local/lib") -- _add_directory(include_dirs, "/usr/local/include") -- -- _add_directory(library_dirs, "/usr/lib") -- _add_directory(include_dirs, "/usr/include") -- # alpine, at least -- _add_directory(library_dirs, "/lib") -- -- # on Windows, look for the OpenJPEG libraries in the location that -- # the official installer puts them -- if sys.platform == "win32": -- program_files = os.environ.get('ProgramFiles', '') -- best_version = (0, 0) -- best_path = None -- for name in os.listdir(program_files): -- if name.startswith('OpenJPEG '): -- version = tuple(int(x) for x in -- name[9:].strip().split('.')) -- if version > best_version: -- best_version = version -- best_path = os.path.join(program_files, name) -- -- if best_path: -- _dbg('Adding %s to search list', best_path) -- _add_directory(library_dirs, os.path.join(best_path, 'lib')) -- _add_directory(include_dirs, -- os.path.join(best_path, 'include')) -- - # - # insert new dirs *before* default libs, to avoid conflicts - # between Python PYD stub libs and real libraries -- 2.30.2