Skip to content

Commit

Permalink
dev-python/PySDL2: Bump to 0.9.7, py3.9
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Górny <[email protected]>
  • Loading branch information
mgorny committed Jul 12, 2020
1 parent f4ab431 commit 79ca08d
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
1 change: 1 addition & 0 deletions dev-python/PySDL2/Manifest
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
DIST PySDL2-0.9.6.tar.gz 1048158 BLAKE2B 70a450990dd73169489af2d5b218eea0794c9f75948d774680df4b4423855318ddc6d16a0453f62361d4f0b81e872edc067235c4f946476ea8988e16cd0de44c SHA512 676b1b3381b614122442c70fe4cbd7c210ef3d8695c2babd37938e67b5cfeb2f8acbdcb914c5f68aceb549d89f7a77bdc80c7406b340b0e38c22543df8d46739
DIST PySDL2-0.9.7.tar.gz 1079253 BLAKE2B 986a21d8c2f4f45df683d85a8369be7b39f102e59a1b3fd37e2941065a1174d5cd6dd056f78fbc66663e2cf50228ee40abf67352e5ae75176a9c000fb6f672fb SHA512 10d40063762272eaaae1cb6290e007481887806938ba0ba17d28974a3a3c8b36570054587001d00eb9ab4aa2375c616c43a81c7e7308fbb9b61b55b3eb7da5ac
61 changes: 61 additions & 0 deletions dev-python/PySDL2/PySDL2-0.9.7.ebuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

PYTHON_COMPAT=( python3_{6..9} )
inherit distutils-r1

DESCRIPTION="Python (ctypes) bindings for SDL2 libraries"
HOMEPAGE="https://github.com/marcusva/py-sdl2 https://pypi.org/project/PySDL2/"
SRC_URI="mirror://pypi/${PN::1}/${PN}/${P}.tar.gz"

LICENSE="|| ( public-domain CC0-1.0 ZLIB )"
SLOT="0"
KEYWORDS="~amd64 ~x86"

# Optional deps:
# - dev-python/numpy,
# - dev-python/pillow,
# - media-libs/sdl2-* (loaded dynamically via ctypes).
#
# If a reverse dependency needs the specific module, it should
# explicitly depend on the optional module in question. You also
# probably need to explicitly require some media-libs/libsdl2 flags.
RDEPEND="media-libs/libsdl2"

# Require all of SDL2 libraries and at least the most common subsystems
# for better test coverage.
DEPEND="
test? (
dev-python/numpy[${PYTHON_USEDEP}]
dev-python/pillow[${PYTHON_USEDEP}]
media-libs/libsdl2[joystick,sound,video]
media-libs/sdl2-gfx
media-libs/sdl2-image
media-libs/sdl2-mixer
media-libs/sdl2-ttf
)"

distutils_enable_tests pytest

PATCHES=(
"${FILESDIR}"/${P}-nameerror.patch
)

src_prepare() {
# tarball uses DOS line endings
find '(' -name '*.py' -o -name '*.rst' -o -name '*.txt' ')' \
-type f -exec sed -i -e 's/\r$//' {} + || die

distutils-r1_src_prepare
}

src_test() {
# from .travis.yml
local -x SDL_VIDEODRIVER=dummy
local -x SDL_AUDIODRIVER=dummy
local -x SDL_RENDER_DRIVER=software

distutils-r1_src_test
}
24 changes: 24 additions & 0 deletions dev-python/PySDL2/files/PySDL2-0.9.7-nameerror.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
From 635048e81402f3dcc9719c060a67f33e6950649c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <[email protected]>
Date: Sun, 12 Jul 2020 08:18:06 +0200
Subject: [PATCH] Fix NameError when calling SDL_SetColorKey()

---
sdl2/ext/image.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sdl2/ext/image.py b/sdl2/ext/image.py
index 1a413e1..49d897d 100644
--- a/sdl2/ext/image.py
+++ b/sdl2/ext/image.py
@@ -154,6 +154,6 @@ def load_image(fname, enforce=None):
# If the image has a single transparent palette index, set
# that index as the color key to make blitting correct.
if 'transparency' in image.info and isinstance(image.info['transparency'], int):
- sdl2.SDL_SetColorKey(imgsurface, True, image.info['transparency'])
+ surface.SDL_SetColorKey(imgsurface, True, image.info['transparency'])

return imgsurface
--
2.27.0

0 comments on commit 79ca08d

Please sign in to comment.