dev-python/pillow: re-support pypy
authorVirgil Dupras <vdupras@gentoo.org>
Fri, 7 Sep 2018 18:43:59 +0000 (14:43 -0400)
committerVirgil Dupras <vdupras@gentoo.org>
Fri, 7 Sep 2018 18:45:31 +0000 (14:45 -0400)
pypy support had been dropped in pillow 4.3 ebuild and is being
re-introduced now. Tests pass.

This required a little bit of library path fiddling in setup.py, the
root cause of it being that `sysconfig.get_config_var('prefix')` under
pypy doesn't return the same thing as with CPython. This fiddling was
required if we wanted to keep the --disable-platform-guessing flag.

I tried not to break the fix that was done in bug 661830.

I've tried pypy3, but not all tests passed. I didn't investigate further
(I'm just trying to return to pre-4.3 levels so that we can stabilize)

Bug: https://bugs.gentoo.org/661830
Closes: https://bugs.gentoo.org/608620
Package-Manager: Portage-2.3.49, Repoman-2.3.10

dev-python/pillow/files/pillow-5.2.0-fix-lib-paths.patch [new file with mode: 0644]
dev-python/pillow/files/pillow-5.2.0-no-usr-lib.patch [deleted file]
dev-python/pillow/pillow-5.2.0.ebuild

diff --git a/dev-python/pillow/files/pillow-5.2.0-fix-lib-paths.patch b/dev-python/pillow/files/pillow-5.2.0-fix-lib-paths.patch
new file mode 100644 (file)
index 0000000..b736818
--- /dev/null
@@ -0,0 +1,16 @@
+diff --git a/setup.py b/setup.py
+index 761d552c..c4a55092 100755
+--- a/setup.py
++++ b/setup.py
+@@ -435,6 +435,11 @@ class pil_build_ext(build_ext):
+                 _add_directory(include_dirs,
+                                os.path.join(best_path, 'include'))
++        # The logic above fails in many cases (such as pypy builds) and we fix
++        # it here by making sure we look in standard places first.
++        library_dirs = ['/usr/lib64', '/usr/lib'] + library_dirs
++        include_dirs = ['/usr/include'] + include_dirs
++
+         #
+         # insert new dirs *before* default libs, to avoid conflicts
+         # between Python PYD stub libs and real libraries
diff --git a/dev-python/pillow/files/pillow-5.2.0-no-usr-lib.patch b/dev-python/pillow/files/pillow-5.2.0-no-usr-lib.patch
deleted file mode 100644 (file)
index 4b6cc50..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
---- a/setup.py 2018-07-22 22:09:23.840195059 +0300
-+++ a/setup.py 2018-07-22 22:11:43.400626135 +0300
-@@ -258,9 +258,8 @@ 
-                     _add_directory(library_dirs, d)
-         prefix = sysconfig.get_config_var("prefix")
-         if prefix:
--            _add_directory(library_dirs, os.path.join(prefix, "lib"))
-             _add_directory(include_dirs, os.path.join(prefix, "include"))
-         #
-         # add platform directories
index 406d711de0d99dd06aaca457c0f0735b68583a4b..04ae41085612e7843510081bd86ddef198cb92ef 100644 (file)
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python2_7 python3_{5,6,7} )
+PYTHON_COMPAT=( python2_7 python3_{5,6,7} pypy )
 PYTHON_REQ_USE='tk?,threads(+)'
 
 inherit distutils-r1 virtualx
@@ -47,7 +47,7 @@ DEPEND="${RDEPEND}
 S="${WORKDIR}/${MY_P}"
 
 PATCHES=(
-       "${FILESDIR}/${PN}-5.2.0-no-usr-lib.patch"
+       "${FILESDIR}/${PN}-5.2.0-fix-lib-paths.patch"
 )
 
 python_configure_all() {