Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/PySDL2/files/, dev-python/PySDL2/
Date: Mon, 01 Jan 2018 13:47:43
Message-Id: 1514814445.b5bfe230bd9108c5b6bf4cf45a781a6e7a1f4fbb.mgorny@gentoo
1 commit: b5bfe230bd9108c5b6bf4cf45a781a6e7a1f4fbb
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Mon Jan 1 13:13:43 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Mon Jan 1 13:47:25 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b5bfe230
7
8 dev-python/PySDL2: New package, needed for games-emu/m64py
9
10 Bug: https://bugs.gentoo.org/626488
11
12 dev-python/PySDL2/Manifest | 1 +
13 dev-python/PySDL2/PySDL2-0.9.6.ebuild | 64 ++++++++++++++++++++++
14 ...lways-allow-greater-patch-version-of-SDL2.patch | 47 ++++++++++++++++
15 ...-Handle-missing-haptic-support-gracefully.patch | 26 +++++++++
16 dev-python/PySDL2/metadata.xml | 15 +++++
17 5 files changed, 153 insertions(+)
18
19 diff --git a/dev-python/PySDL2/Manifest b/dev-python/PySDL2/Manifest
20 new file mode 100644
21 index 00000000000..f44f4f7a63a
22 --- /dev/null
23 +++ b/dev-python/PySDL2/Manifest
24 @@ -0,0 +1 @@
25 +DIST PySDL2-0.9.6.tar.gz 1048158 BLAKE2B 70a450990dd73169489af2d5b218eea0794c9f75948d774680df4b4423855318ddc6d16a0453f62361d4f0b81e872edc067235c4f946476ea8988e16cd0de44c SHA512 676b1b3381b614122442c70fe4cbd7c210ef3d8695c2babd37938e67b5cfeb2f8acbdcb914c5f68aceb549d89f7a77bdc80c7406b340b0e38c22543df8d46739
26
27 diff --git a/dev-python/PySDL2/PySDL2-0.9.6.ebuild b/dev-python/PySDL2/PySDL2-0.9.6.ebuild
28 new file mode 100644
29 index 00000000000..d761ef0b205
30 --- /dev/null
31 +++ b/dev-python/PySDL2/PySDL2-0.9.6.ebuild
32 @@ -0,0 +1,64 @@
33 +# Copyright 1999-2018 Gentoo Foundation
34 +# Distributed under the terms of the GNU General Public License v2
35 +
36 +EAPI=6
37 +
38 +PYTHON_COMPAT=( python{2_7,3_{4,5,6}} )
39 +inherit distutils-r1
40 +
41 +DESCRIPTION="Python (ctypes) bindings for SDL2 libraries"
42 +HOMEPAGE="https://github.com/marcusva/py-sdl2 https://pypi.python.org/pypi/PySDL2"
43 +SRC_URI="mirror://pypi/${PN::1}/${PN}/${P}.tar.gz"
44 +
45 +LICENSE="|| ( public-domain CC0-1.0 ZLIB )"
46 +SLOT="0"
47 +KEYWORDS="~amd64 ~x86"
48 +IUSE="test"
49 +
50 +# Optional deps:
51 +# - dev-python/numpy,
52 +# - dev-python/pillow,
53 +# - media-libs/sdl2-* (loaded dynamically via ctypes).
54 +#
55 +# If a reverse dependency needs the specific module, it should
56 +# explicitly depend on the optional module in question. You also
57 +# probably need to explicitly require some media-libs/libsdl2 flags.
58 +RDEPEND="media-libs/libsdl2"
59 +
60 +# Require all of SDL2 libraries and at least the most common subsystems
61 +# for better test coverage.
62 +DEPEND="
63 + test? (
64 + dev-python/numpy[${PYTHON_USEDEP}]
65 + dev-python/pillow[${PYTHON_USEDEP}]
66 + media-libs/libsdl2[joystick,sound,video]
67 + media-libs/sdl2-gfx
68 + media-libs/sdl2-image
69 + media-libs/sdl2-mixer
70 + media-libs/sdl2-ttf
71 + )"
72 +
73 +PATCHES=(
74 + # fix tests to allow newer versions of libsdl2
75 + "${FILESDIR}"/PySDL2-0.9.6-0001-test-Always-allow-greater-patch-version-of-SDL2.patch
76 + # fix tests to handle missing haptic support gracefully
77 + "${FILESDIR}"/PySDL2-0.9.6-0002-test-Handle-missing-haptic-support-gracefully.patch
78 +)
79 +
80 +src_prepare() {
81 + # tarball uses DOS line endings
82 + find '(' -name '*.py' -o -name '*.rst' -o -name '*.txt' ')' \
83 + -type f -exec sed -i -e 's/\r$//' {} + || die
84 +
85 + distutils-r1_src_prepare
86 +}
87 +
88 +python_test() {
89 + # from .travis.yml
90 + local -x SDL_VIDEODRIVER=dummy
91 + local -x SDL_AUDIODRIVER=dummy
92 + local -x SDL_RENDER_DRIVER=software
93 +
94 + "${PYTHON}" -m unittest discover -v \
95 + -s sdl2/test -p '*_test.py' || die "Tests fail with ${EPYTHON}"
96 +}
97
98 diff --git a/dev-python/PySDL2/files/PySDL2-0.9.6-0001-test-Always-allow-greater-patch-version-of-SDL2.patch b/dev-python/PySDL2/files/PySDL2-0.9.6-0001-test-Always-allow-greater-patch-version-of-SDL2.patch
99 new file mode 100644
100 index 00000000000..0b72f903663
101 --- /dev/null
102 +++ b/dev-python/PySDL2/files/PySDL2-0.9.6-0001-test-Always-allow-greater-patch-version-of-SDL2.patch
103 @@ -0,0 +1,47 @@
104 +From d34a898bb8d8bfd9cb4a85ff880826e4c7f2b0f7 Mon Sep 17 00:00:00 2001
105 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
106 +Date: Mon, 1 Jan 2018 12:31:52 +0100
107 +Subject: [PATCH 1/2] test: Always allow greater patch-version of SDL2
108 +
109 +Similarly to sdlimage_test, allow newer patch-version of other SDL2
110 +libraries. There is no technical reason to prevent people from upgrading
111 +libsdl2 while having old PySDL2 installed, and there is no reason to
112 +make tests fail every time libsdl2 happens to be upgraded.
113 +
114 +(backported for 0.9.6)
115 +
116 +Closes: https://github.com/marcusva/py-sdl2/issues/115
117 +---
118 + sdl2/test/sdlmixer_test.py | 2 +-
119 + sdl2/test/version_test.py | 2 +-
120 + 2 files changed, 2 insertions(+), 2 deletions(-)
121 +
122 +diff --git a/sdl2/test/sdlmixer_test.py b/sdl2/test/sdlmixer_test.py
123 +index 00c2ca6..1cebe55 100644
124 +--- a/sdl2/test/sdlmixer_test.py
125 ++++ b/sdl2/test/sdlmixer_test.py
126 +@@ -27,7 +27,7 @@ class SDLMixerTest(unittest.TestCase):
127 + self.assertIsInstance(v.contents, version.SDL_version)
128 + self.assertEqual(v.contents.major, 2)
129 + self.assertEqual(v.contents.minor, 0)
130 +- self.assertEqual(v.contents.patch, 1)
131 ++ self.assertGreaterEqual(v.contents.patch, 1)
132 +
133 + if __name__ == '__main__':
134 + sys.exit(unittest.main())
135 +diff --git a/sdl2/test/version_test.py b/sdl2/test/version_test.py
136 +index 51b5065..60e5bcf 100644
137 +--- a/sdl2/test/version_test.py
138 ++++ b/sdl2/test/version_test.py
139 +@@ -25,7 +25,7 @@ class SDLVersionTest(unittest.TestCase):
140 + self.assertEqual(type(v), version.SDL_version)
141 + self.assertEqual(v.major, 2)
142 + self.assertEqual(v.minor, 0)
143 +- self.assertEqual(v.patch, 6)
144 ++ self.assertGreaterEqual(v.patch, 6)
145 +
146 + def test_SDL_VERSIONNUM(self):
147 + self.assertEqual(version.SDL_VERSIONNUM(1, 2, 3), 1203)
148 +--
149 +2.16.0.rc0
150 +
151
152 diff --git a/dev-python/PySDL2/files/PySDL2-0.9.6-0002-test-Handle-missing-haptic-support-gracefully.patch b/dev-python/PySDL2/files/PySDL2-0.9.6-0002-test-Handle-missing-haptic-support-gracefully.patch
153 new file mode 100644
154 index 00000000000..2b03fed4d09
155 --- /dev/null
156 +++ b/dev-python/PySDL2/files/PySDL2-0.9.6-0002-test-Handle-missing-haptic-support-gracefully.patch
157 @@ -0,0 +1,26 @@
158 +From 4a38a0ef4c13ec3c518b78c0e56550fb8af43119 Mon Sep 17 00:00:00 2001
159 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
160 +Date: Mon, 1 Jan 2018 13:29:16 +0100
161 +Subject: [PATCH 2/2] test: Handle missing haptic support gracefully
162 +
163 +---
164 + sdl2/test/sdl_test.py | 3 ++-
165 + 1 file changed, 2 insertions(+), 1 deletion(-)
166 +
167 +diff --git a/sdl2/test/sdl_test.py b/sdl2/test/sdl_test.py
168 +index 70c2e98..402e549 100644
169 +--- a/sdl2/test/sdl_test.py
170 ++++ b/sdl2/test/sdl_test.py
171 +@@ -47,7 +47,8 @@ class SDLTest(unittest.TestCase):
172 + "FreeBSD des not support haptic input yet")
173 + def test_SDL_INIT_HAPTIC(self):
174 + ret = SDL_Init(SDL_INIT_HAPTIC)
175 +- self.assertEqual(ret, 0, SDL_GetError())
176 ++ if ret != 0:
177 ++ self.skipTest('Haptic subsystem not supported')
178 + ret = SDL_WasInit(SDL_INIT_HAPTIC)
179 + self.assertEqual(ret, SDL_INIT_HAPTIC)
180 + SDL_QuitSubSystem(SDL_INIT_HAPTIC)
181 +--
182 +2.16.0.rc0
183 +
184
185 diff --git a/dev-python/PySDL2/metadata.xml b/dev-python/PySDL2/metadata.xml
186 new file mode 100644
187 index 00000000000..dbc51f1b956
188 --- /dev/null
189 +++ b/dev-python/PySDL2/metadata.xml
190 @@ -0,0 +1,15 @@
191 +<?xml version="1.0" encoding="UTF-8"?>
192 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
193 +<pkgmetadata>
194 + <maintainer type="person">
195 + <email>mgorny@g.o</email>
196 + <name>Michał Górny</name>
197 + </maintainer>
198 + <maintainer type="project">
199 + <email>python@g.o</email>
200 + </maintainer>
201 + <upstream>
202 + <remote-id type="github">marcusva/py-sdl2</remote-id>
203 + <remote-id type="pypi">PySDL2</remote-id>
204 + </upstream>
205 +</pkgmetadata>