commit:     495bca6e5c9b04a9741e90dc2bc1d0170608ce36
Author:     Julian Ospald <hasufell <AT> gentoo <DOT> org>
AuthorDate: Wed Aug 12 11:34:26 2015 +0000
Commit:     Julian Ospald <hasufell <AT> gentoo <DOT> org>
CommitDate: Wed Aug 12 11:35:36 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=495bca6e

dev-python/pygame_sdl2: fix compilation with cython-0.23

Gentoo-Bug: 557216
Upstream-Bug-url: https://github.com/renpy/pygame_sdl2/issues/13
Upstream-Patch-url: 
https://github.com/renpy/pygame_sdl2/commit/b3acbed1942f63dbbeacfe2d4736be97ae2c8ab9
Reported-by: Erik Zeek

 .../files/pygame_sdl2-6.99.5-cython-0.23.patch     | 44 ++++++++++++++++++++++
 dev-python/pygame_sdl2/pygame_sdl2-6.99.5.ebuild   |  2 +
 2 files changed, 46 insertions(+)

diff --git a/dev-python/pygame_sdl2/files/pygame_sdl2-6.99.5-cython-0.23.patch 
b/dev-python/pygame_sdl2/files/pygame_sdl2-6.99.5-cython-0.23.patch
new file mode 100644
index 0000000..7ef65e0
--- /dev/null
+++ b/dev-python/pygame_sdl2/files/pygame_sdl2-6.99.5-cython-0.23.patch
@@ -0,0 +1,44 @@
+From b3acbed1942f63dbbeacfe2d4736be97ae2c8ab9 Mon Sep 17 00:00:00 2001
+From: Tom Rothamel <[email protected]>
+Date: Tue, 11 Aug 2015 20:58:46 -0400
+Subject: [PATCH] Fix integer division with cython 0.23.
+
+Fixes #13.
+---
+ src/pygame_sdl2/rwobject.pyx  | 2 +-
+ src/pygame_sdl2/transform.pyx | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/pygame_sdl2/rwobject.pyx b/src/pygame_sdl2/rwobject.pyx
+index 4445fb7..11ae7eb 100644
+--- a/src/pygame_sdl2/rwobject.pyx
++++ b/src/pygame_sdl2/rwobject.pyx
+@@ -146,7 +146,7 @@ cdef size_t subfile_read(SDL_RWops *context, void *ptr, 
size_t size, size_t maxn
+     cdef size_t rv;
+ 
+     if size * maxnum > left:
+-        maxnum = left / size
++        maxnum = left // size
+ 
+     if maxnum == 0:
+         return 0
+diff --git a/src/pygame_sdl2/transform.pyx b/src/pygame_sdl2/transform.pyx
+index 933bfce..1afe87e 100644
+--- a/src/pygame_sdl2/transform.pyx
++++ b/src/pygame_sdl2/transform.pyx
+@@ -115,13 +115,13 @@ cdef uint32_t get_at(SDL_Surface *surf, int x, int y) 
nogil:
+         y = surf.h - 1
+ 
+     cdef uint32_t *p = <uint32_t*>surf.pixels
+-    p += y * (surf.pitch / sizeof(uint32_t))
++    p += y * (surf.pitch // sizeof(uint32_t))
+     p += x
+     return p[0]
+ 
+ cdef void set_at(SDL_Surface *surf, int x, int y, uint32_t color) nogil:
+     cdef uint32_t *p = <uint32_t*>surf.pixels
+-    p += y * (surf.pitch / sizeof(uint32_t))
++    p += y * (surf.pitch // sizeof(uint32_t))
+     p += x
+     p[0] = color
+ 

diff --git a/dev-python/pygame_sdl2/pygame_sdl2-6.99.5.ebuild 
b/dev-python/pygame_sdl2/pygame_sdl2-6.99.5.ebuild
index 3496c80..6507c34 100644
--- a/dev-python/pygame_sdl2/pygame_sdl2-6.99.5.ebuild
+++ b/dev-python/pygame_sdl2/pygame_sdl2-6.99.5.ebuild
@@ -27,3 +27,5 @@ RDEPEND="dev-python/numpy[${PYTHON_USEDEP}]
 DEPEND="${RDEPEND}"
 
 S=${WORKDIR}/pygame-sdl2-for-renpy-${PV}
+
+PATCHES=( "${FILESDIR}"/${P}-cython-0.23.patch )

Reply via email to