Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pillow/
Date: Tue, 18 Jan 2022 08:38:54
Message-Id: 1642495126.c67f1136fe6f7ee15256831f4d89d7cadf827c4b.mgorny@gentoo
1 commit: c67f1136fe6f7ee15256831f4d89d7cadf827c4b
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jan 17 13:15:01 2022 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Jan 18 08:38:46 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c67f1136
7
8 dev-python/pillow: Migrate to PEP517
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-python/pillow/pillow-9.0.0-r1.ebuild | 103 +++++++++++++++++++++++++++++++
13 1 file changed, 103 insertions(+)
14
15 diff --git a/dev-python/pillow/pillow-9.0.0-r1.ebuild b/dev-python/pillow/pillow-9.0.0-r1.ebuild
16 new file mode 100644
17 index 000000000000..f0ffc42977fe
18 --- /dev/null
19 +++ b/dev-python/pillow/pillow-9.0.0-r1.ebuild
20 @@ -0,0 +1,103 @@
21 +# Copyright 1999-2022 Gentoo Authors
22 +# Distributed under the terms of the GNU General Public License v2
23 +
24 +EAPI=8
25 +
26 +DISTUTILS_USE_PEP517=setuptools
27 +PYTHON_COMPAT=( python3_{8..10} pypy3 )
28 +PYTHON_REQ_USE='tk?,threads(+)'
29 +
30 +inherit distutils-r1 toolchain-funcs virtualx
31 +
32 +MY_PN=Pillow
33 +MY_P=${MY_PN}-${PV}
34 +
35 +DESCRIPTION="Python Imaging Library (fork)"
36 +HOMEPAGE="https://python-pillow.org/"
37 +SRC_URI="https://github.com/python-pillow/Pillow/archive/${PV}.tar.gz -> ${P}.tar.gz"
38 +S="${WORKDIR}/${MY_P}"
39 +
40 +LICENSE="HPND"
41 +SLOT="0"
42 +KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~x86-linux"
43 +IUSE="examples imagequant +jpeg jpeg2k lcms test tiff tk truetype webp xcb zlib"
44 +REQUIRED_USE="test? ( jpeg jpeg2k tiff truetype )"
45 +RESTRICT="!test? ( test )"
46 +
47 +DEPEND="
48 + imagequant? ( media-gfx/libimagequant:0 )
49 + jpeg? ( virtual/jpeg:0 )
50 + jpeg2k? ( media-libs/openjpeg:2= )
51 + lcms? ( media-libs/lcms:2= )
52 + tiff? ( media-libs/tiff:0=[jpeg,zlib] )
53 + truetype? ( media-libs/freetype:2= )
54 + webp? ( media-libs/libwebp:0= )
55 + xcb? ( x11-libs/libxcb )
56 + zlib? ( sys-libs/zlib:0= )"
57 +RDEPEND="${DEPEND}
58 + dev-python/olefile[${PYTHON_USEDEP}]"
59 +BDEPEND="
60 + virtual/pkgconfig
61 + test? (
62 + ${RDEPEND}
63 + dev-python/pytest[${PYTHON_USEDEP}]
64 + || (
65 + media-gfx/imagemagick[png]
66 + media-gfx/graphicsmagick[png]
67 + )
68 + )
69 +"
70 +
71 +usepil() {
72 + usex "${1}" enable disable
73 +}
74 +
75 +python_configure_all() {
76 + # It's important that these flags are also passed during the install phase
77 + # as well. Make sure of that if you change the lines below. See bug 661308.
78 + cat >> setup.cfg <<-EOF || die
79 + [build_ext]
80 + disable_platform_guessing = True
81 + $(usepil truetype)_freetype = True
82 + $(usepil jpeg)_jpeg = True
83 + $(usepil jpeg2k)_jpeg2000 = True
84 + $(usepil lcms)_lcms = True
85 + $(usepil tiff)_tiff = True
86 + $(usepil imagequant)_imagequant = True
87 + $(usepil webp)_webp = True
88 + $(usepil webp)_webpmux = True
89 + $(usepil xcb)_xcb = True
90 + $(usepil zlib)_zlib = True
91 + EOF
92 +
93 + # setup.py sucks at adding the right toolchain paths but it does
94 + # accept additional ones from INCLUDE and LIB so set these. You
95 + # wouldn't normally need these at all as the toolchain should look
96 + # here anyway but this setup.py does stupid things.
97 + export \
98 + INCLUDE="${ESYSROOT}"/usr/include \
99 + LIB="${ESYSROOT}"/usr/$(get_libdir)
100 +
101 + # We have patched in this env var.
102 + tc-export PKG_CONFIG
103 +}
104 +
105 +python_test() {
106 + "${EPYTHON}" selftest.py --installed || die "selftest failed with ${EPYTHON}"
107 + # no:relaxed: pytest-relaxed plugin make our tests fail. deactivate if installed
108 + virtx epytest -p no:relaxed
109 +}
110 +
111 +python_install() {
112 + python_doheader src/libImaging/*.h
113 + distutils-r1_python_install
114 +}
115 +
116 +python_install_all() {
117 + if use examples ; then
118 + docinto example
119 + dodoc docs/example/*
120 + docompress -x /usr/share/doc/${PF}/example
121 + fi
122 + distutils-r1_python_install_all
123 +}