Gentoo Archives: gentoo-commits

From: James Le Cuirot <chewi@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pillow/, dev-python/pillow/files/
Date: Thu, 10 Jan 2019 21:21:40
Message-Id: 1547155192.05ca39b5dc693c4e105e9afbcf556428c6e8ef3d.chewi@gentoo
1 commit: 05ca39b5dc693c4e105e9afbcf556428c6e8ef3d
2 Author: James Le Cuirot <chewi <AT> gentoo <DOT> org>
3 AuthorDate: Tue Jan 8 23:00:42 2019 +0000
4 Commit: James Le Cuirot <chewi <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 10 21:19:52 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=05ca39b5
7
8 dev-python/pillow: Fix cross-compiling of 5.4.1
9
10 Normally you shouldn't add -I/usr/include or -L/usr/lib, even if it is
11 prepended with the SYSROOT, but Pillow's stupid build system checks
12 for headers with Python rather than the toolchain. Luckily only
13 minimal patching is needed.
14
15 Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
16 Package-Manager: Portage-2.3.49, Repoman-2.3.10
17
18 .../pillow/files/pillow-5.4.1-pkg-config.patch | 28 ++++++++++++++++++++++
19 .../files/pillow-5.4.1-toolchain-paths.patch | 12 ++++++++++
20 dev-python/pillow/pillow-5.4.1.ebuild | 15 ++++++++++--
21 3 files changed, 53 insertions(+), 2 deletions(-)
22
23 diff --git a/dev-python/pillow/files/pillow-5.4.1-pkg-config.patch b/dev-python/pillow/files/pillow-5.4.1-pkg-config.patch
24 new file mode 100644
25 index 00000000000..ec227b3f80a
26 --- /dev/null
27 +++ b/dev-python/pillow/files/pillow-5.4.1-pkg-config.patch
28 @@ -0,0 +1,28 @@
29 +diff -Naur a/setup.py b/setup.py
30 +--- a/setup.py 2019-01-06 12:12:16.000000000 +0000
31 ++++ b/setup.py 2019-01-08 23:04:45.574698210 +0000
32 +@@ -197,12 +197,13 @@
33 +
34 + def _pkg_config(name):
35 + try:
36 ++ command = os.environ.get('PKG_CONFIG', 'pkg-config')
37 + command_libs = [
38 +- 'pkg-config',
39 ++ command,
40 + '--libs-only-L', name,
41 + ]
42 + command_cflags = [
43 +- 'pkg-config',
44 ++ command,
45 + '--cflags-only-I', name,
46 + ]
47 + if not DEBUG:
48 +@@ -298,7 +299,7 @@
49 + _add_directory(include_dirs, "src/libImaging")
50 +
51 + pkg_config = None
52 +- if _cmd_exists('pkg-config'):
53 ++ if _cmd_exists(os.environ.get('PKG_CONFIG', 'pkg-config')):
54 + pkg_config = _pkg_config
55 +
56 + #
57
58 diff --git a/dev-python/pillow/files/pillow-5.4.1-toolchain-paths.patch b/dev-python/pillow/files/pillow-5.4.1-toolchain-paths.patch
59 new file mode 100644
60 index 00000000000..d3e95eef516
61 --- /dev/null
62 +++ b/dev-python/pillow/files/pillow-5.4.1-toolchain-paths.patch
63 @@ -0,0 +1,12 @@
64 +diff -Naur a/setup.py b/setup.py
65 +--- a/setup.py 2019-01-08 23:06:33.082873069 +0000
66 ++++ b/setup.py 2019-01-08 23:06:47.707165225 +0000
67 +@@ -356,7 +356,7 @@
68 + for d in os.environ[k].split(os.path.pathsep):
69 + _add_directory(library_dirs, d)
70 +
71 +- prefix = sysconfig.get_config_var("prefix")
72 ++ prefix = None
73 + if prefix:
74 + _add_directory(library_dirs, os.path.join(prefix, "lib"))
75 + _add_directory(include_dirs, os.path.join(prefix, "include"))
76
77 diff --git a/dev-python/pillow/pillow-5.4.1.ebuild b/dev-python/pillow/pillow-5.4.1.ebuild
78 index 61d35cce7f6..75df944128f 100644
79 --- a/dev-python/pillow/pillow-5.4.1.ebuild
80 +++ b/dev-python/pillow/pillow-5.4.1.ebuild
81 @@ -6,7 +6,7 @@ EAPI=7
82 PYTHON_COMPAT=( python2_7 python3_{4,5,6,7} pypy )
83 PYTHON_REQ_USE='tk?,threads(+)'
84
85 -inherit distutils-r1 virtualx
86 +inherit distutils-r1 toolchain-funcs virtualx
87
88 MY_PN=Pillow
89 MY_P=${MY_PN}-${PV}
90 @@ -47,7 +47,7 @@ DEPEND="${RDEPEND}
91 S="${WORKDIR}/${MY_P}"
92
93 PATCHES=(
94 - "${FILESDIR}/${PN}-5.2.0-fix-lib-paths.patch"
95 + "${FILESDIR}"/${PN}-5.4.1-{pkg-config,toolchain-paths}.patch
96 )
97
98 python_configure_all() {
99 @@ -66,6 +66,17 @@ python_configure_all() {
100 $(use_enable webp webpmux)
101 $(use_enable zlib)
102 )
103 +
104 + # setup.py sucks at adding the right toolchain paths but it does
105 + # accept additional ones from INCLUDE and LIB so set these. You
106 + # wouldn't normally need these at all as the toolchain should look
107 + # here anyway but this setup.py does stupid things.
108 + export \
109 + INCLUDE=${ESYSROOT}/usr/include \
110 + LIB=${ESYSROOT}/usr/$(get_libdir)
111 +
112 + # We have patched in this env var.
113 + tc-export PKG_CONFIG
114 }
115
116 python_compile_all() {