*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / dev-python / pygame / pygame-1.9.3.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 PYTHON_COMPAT=( python{2_7,3_6} )
6 DISTUTILS_IN_SOURCE_BUILD=1
7 inherit flag-o-matic distutils-r1 virtualx
8
9 DESCRIPTION="Python bindings for SDL multimedia library"
10 HOMEPAGE="http://www.pygame.org/"
11 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
12
13 LICENSE="LGPL-2.1"
14 SLOT="0"
15 KEYWORDS="~alpha amd64 ~arm ~hppa ~ia64 ppc ~sparc x86"
16 IUSE="doc examples midi X"
17
18 DEPEND="dev-python/numpy[${PYTHON_USEDEP}]
19         >=media-libs/sdl-image-1.2.2[png,jpeg]
20         >=media-libs/sdl-mixer-1.2.4
21         >=media-libs/sdl-ttf-2.0.6
22         >=media-libs/smpeg-0.4.4-r1
23         midi? ( media-libs/portmidi )
24         X? ( >=media-libs/libsdl-1.2.5[X,video] )
25         !X? ( >=media-libs/libsdl-1.2.5 )"
26 RDEPEND="${DEPEND}"
27
28 DOCS=( WHATSNEW )
29
30 # various module import and data path issues
31 RESTRICT=test
32
33 python_configure() {
34         PORTMIDI_INC_PORTTIME=1 LOCALBASE="${EPREFIX}/usr" "${EPYTHON}" config.py -auto
35
36         if ! use X; then
37                 sed -e "s:^scrap :#&:" -i Setup || die "sed failed"
38         fi
39
40         # Disable automagic dependency on PortMidi.
41         if ! use midi; then
42                 sed -e "s:^pypm :#&:" -i Setup || die "sed failed"
43         fi
44 }
45
46 python_compile() {
47         if [[ ${EPYTHON} == python2* ]]; then
48                 local CFLAGS=${CFLAGS} CXXFLAGS=${CXXFLAGS}
49
50                 append-flags -fno-strict-aliasing
51         fi
52
53         distutils-r1_python_compile
54 }
55
56 python_test() {
57         PYTHONPATH="${BUILD_DIR}/lib" virtx "${EPYTHON}" -m pygame.tests
58 }
59
60 python_install() {
61         distutils-r1_python_install
62
63         # Bug #497720
64         rm -fr "${D}"$(python_get_sitedir)/pygame/{docs,examples,tests}/ || die
65 }
66
67 python_install_all() {
68         distutils-r1_python_install_all
69
70         if use doc; then
71                 docinto html
72                 dodoc -r docs/*
73         fi
74
75         if use examples; then
76                 insinto /usr/share/doc/${PF}/examples
77                 doins -r examples/*
78         fi
79 }