1 |
|
# Copyright 1999-2020 Gentoo Authors
|
|
1 |
# Copyright 1999-2023 Gentoo Authors
|
2 |
2 |
# Distributed under the terms of the GNU General Public License v2
|
3 |
3 |
|
4 |
|
EAPI=7
|
|
4 |
EAPI=8
|
5 |
5 |
|
6 |
|
PYTHON_COMPAT=( python2_7 )
|
|
6 |
DISTUTILS_EXT=1
|
|
7 |
# setuptools wrapper
|
|
8 |
DISTUTILS_USE_PEP517=standalone
|
|
9 |
PYTHON_COMPAT=( python3_{10..12} pypy3 )
|
7 |
10 |
PYTHON_REQ_USE='tk?,threads(+)'
|
8 |
11 |
|
9 |
12 |
inherit distutils-r1 toolchain-funcs virtualx
|
... | ... | |
12 |
15 |
MY_P=${MY_PN}-${PV}
|
13 |
16 |
|
14 |
17 |
DESCRIPTION="Python Imaging Library (fork)"
|
15 |
|
HOMEPAGE="https://python-pillow.org/"
|
16 |
|
SRC_URI="https://github.com/python-pillow/Pillow/archive/${PV}.tar.gz -> ${P}.tar.gz"
|
|
18 |
HOMEPAGE="
|
|
19 |
https://python-pillow.org/
|
|
20 |
https://github.com/python-pillow/
|
|
21 |
https://pypi.org/project/Pillow/
|
|
22 |
"
|
|
23 |
SRC_URI="
|
|
24 |
https://github.com/python-pillow/Pillow/archive/${PV}.tar.gz
|
|
25 |
-> ${P}.gh.tar.gz
|
|
26 |
"
|
17 |
27 |
S="${WORKDIR}/${MY_P}"
|
18 |
28 |
|
19 |
29 |
LICENSE="HPND"
|
20 |
|
SLOT="2.7"
|
21 |
|
KEYWORDS="~alpha amd64 arm arm64 ~hppa ppc ppc64 sparc x86 ~amd64-linux ~x86-linux"
|
22 |
|
IUSE="examples imagequant jpeg jpeg2k lcms test tiff tk truetype webp zlib"
|
23 |
|
REQUIRED_USE="test? ( jpeg tiff )"
|
|
30 |
SLOT="0"
|
|
31 |
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~loong ~m68k ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~arm64-macos ~x64-macos"
|
|
32 |
IUSE="examples imagequant +jpeg jpeg2k lcms test tiff tk truetype webp xcb zlib"
|
|
33 |
REQUIRED_USE="test? ( jpeg jpeg2k lcms tiff truetype )"
|
24 |
34 |
RESTRICT="!test? ( test )"
|
25 |
35 |
|
26 |
|
RDEPEND="
|
27 |
|
!dev-python/pillow:0[python_targets_python2_7]
|
28 |
|
dev-python/olefile[${PYTHON_USEDEP}]
|
29 |
|
imagequant? ( media-gfx/libimagequant:0 )
|
30 |
|
jpeg? ( virtual/jpeg:0 )
|
|
36 |
DEPEND="
|
|
37 |
imagequant? ( media-gfx/libimagequant:= )
|
|
38 |
jpeg? ( media-libs/libjpeg-turbo:= )
|
31 |
39 |
jpeg2k? ( media-libs/openjpeg:2= )
|
32 |
40 |
lcms? ( media-libs/lcms:2= )
|
33 |
|
tiff? ( media-libs/tiff:0=[jpeg,zlib] )
|
|
41 |
tiff? ( media-libs/tiff:=[jpeg,zlib] )
|
34 |
42 |
truetype? ( media-libs/freetype:2= )
|
35 |
|
webp? ( media-libs/libwebp:0= )
|
36 |
|
zlib? ( sys-libs/zlib:0= )"
|
37 |
|
DEPEND="${RDEPEND}
|
|
43 |
webp? ( media-libs/libwebp:= )
|
|
44 |
xcb? ( x11-libs/libxcb )
|
|
45 |
zlib? ( sys-libs/zlib:= )
|
|
46 |
"
|
|
47 |
RDEPEND="
|
|
48 |
${DEPEND}
|
|
49 |
dev-python/olefile[${PYTHON_USEDEP}]
|
|
50 |
"
|
|
51 |
BDEPEND="
|
38 |
52 |
dev-python/setuptools[${PYTHON_USEDEP}]
|
|
53 |
dev-python/wheel[${PYTHON_USEDEP}]
|
|
54 |
virtual/pkgconfig
|
39 |
55 |
test? (
|
|
56 |
${RDEPEND}
|
|
57 |
dev-python/defusedxml[${PYTHON_USEDEP}]
|
|
58 |
dev-python/packaging[${PYTHON_USEDEP}]
|
40 |
59 |
dev-python/pytest[${PYTHON_USEDEP}]
|
41 |
|
media-gfx/imagemagick[png]
|
|
60 |
dev-python/pytest-timeout[${PYTHON_USEDEP}]
|
|
61 |
|| (
|
|
62 |
media-gfx/imagemagick[png]
|
|
63 |
media-gfx/graphicsmagick[png]
|
|
64 |
)
|
42 |
65 |
)
|
43 |
66 |
"
|
44 |
67 |
|
45 |
|
distutils_enable_sphinx docs \
|
46 |
|
dev-python/sphinx_rtd_theme
|
|
68 |
EPYTEST_DESELECT=(
|
|
69 |
# TODO; incompatible Qt version?
|
|
70 |
Tests/test_qt_image_qapplication.py::test_sanity
|
|
71 |
)
|
|
72 |
|
|
73 |
usepil() {
|
|
74 |
usex "${1}" enable disable
|
|
75 |
}
|
47 |
76 |
|
48 |
77 |
python_configure_all() {
|
49 |
78 |
# It's important that these flags are also passed during the install phase
|
50 |
79 |
# as well. Make sure of that if you change the lines below. See bug 661308.
|
51 |
|
mydistutilsargs=(
|
52 |
|
build_ext
|
53 |
|
--disable-platform-guessing
|
54 |
|
$(use_enable truetype freetype)
|
55 |
|
$(use_enable jpeg)
|
56 |
|
$(use_enable jpeg2k jpeg2000)
|
57 |
|
$(use_enable lcms)
|
58 |
|
$(use_enable tiff)
|
59 |
|
$(use_enable imagequant)
|
60 |
|
$(use_enable webp)
|
61 |
|
$(use_enable webp webpmux)
|
62 |
|
$(use_enable zlib)
|
63 |
|
)
|
|
80 |
cat >> setup.cfg <<-EOF || die
|
|
81 |
[build_ext]
|
|
82 |
disable_platform_guessing = True
|
|
83 |
$(usepil truetype)_freetype = True
|
|
84 |
$(usepil jpeg)_jpeg = True
|
|
85 |
$(usepil jpeg2k)_jpeg2000 = True
|
|
86 |
$(usepil lcms)_lcms = True
|
|
87 |
$(usepil tiff)_tiff = True
|
|
88 |
$(usepil imagequant)_imagequant = True
|
|
89 |
$(usepil webp)_webp = True
|
|
90 |
$(usepil webp)_webpmux = True
|
|
91 |
$(usepil xcb)_xcb = True
|
|
92 |
$(usepil zlib)_zlib = True
|
|
93 |
EOF
|
64 |
94 |
|
65 |
|
# setup.py sucks at adding the right toolchain paths but it does
|
|
95 |
# setup.py won't let us add the right toolchain paths but it does
|
66 |
96 |
# accept additional ones from INCLUDE and LIB so set these. You
|
67 |
97 |
# wouldn't normally need these at all as the toolchain should look
|
68 |
|
# here anyway but this setup.py does stupid things.
|
|
98 |
# here anyway but it doesn't for this setup.py.
|
69 |
99 |
export \
|
70 |
|
INCLUDE=${ESYSROOT}/usr/include \
|
71 |
|
LIB=${ESYSROOT}/usr/$(get_libdir)
|
|
100 |
INCLUDE="${ESYSROOT}"/usr/include \
|
|
101 |
LIB="${ESYSROOT}"/usr/$(get_libdir)
|
72 |
102 |
|
73 |
103 |
# We have patched in this env var.
|
74 |
104 |
tc-export PKG_CONFIG
|
... | ... | |
79 |
109 |
}
|
80 |
110 |
|
81 |
111 |
python_test() {
|
|
112 |
local EPYTEST_DESELECT=(
|
|
113 |
# TODO (is clipboard unreliable in Xvfb?)
|
|
114 |
Tests/test_imagegrab.py::TestImageGrab::test_grabclipboard
|
|
115 |
)
|
|
116 |
|
82 |
117 |
"${EPYTHON}" selftest.py --installed || die "selftest failed with ${EPYTHON}"
|
83 |
118 |
# no:relaxed: pytest-relaxed plugin make our tests fail. deactivate if installed
|
84 |
|
pytest -vv -p no:relaxed || die "Tests fail with ${EPYTHON}"
|
|
119 |
epytest -p no:relaxed || die "Tests failed with ${EPYTHON}"
|
85 |
120 |
}
|
86 |
121 |
|
87 |
122 |
python_install() {
|
... | ... | |
90 |
125 |
}
|
91 |
126 |
|
92 |
127 |
python_install_all() {
|
|
128 |
if use examples ; then
|
|
129 |
docinto example
|
|
130 |
dodoc docs/example/*
|
|
131 |
docompress -x /usr/share/doc/${PF}/example
|
|
132 |
fi
|
93 |
133 |
distutils-r1_python_install_all
|
94 |
|
rm -r ${D}/usr/share
|
95 |
134 |
}
|