f553a53417bde0a59d9a4ad8dda4adfb56813f1a
[gentoo.git] / dev-python / pygame / pygame-1.9.6.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python{2_7,3_6,3_7} )
7
8 inherit flag-o-matic distutils-r1 virtualx
9
10 DESCRIPTION="Python bindings for SDL multimedia library"
11 HOMEPAGE="http://www.pygame.org/"
12 SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz"
13
14 LICENSE="LGPL-2.1"
15 SLOT="0"
16 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~sparc ~x86"
17 IUSE="doc examples midi X"
18
19 DEPEND="dev-python/numpy[${PYTHON_USEDEP}]
20         >=media-libs/sdl-image-1.2.2[png,jpeg]
21         >=media-libs/sdl-mixer-1.2.4
22         >=media-libs/sdl-ttf-2.0.6
23         >=media-libs/smpeg-0.4.4-r1
24         midi? ( media-libs/portmidi )
25         X? ( >=media-libs/libsdl-1.2.5[X,video] )
26         !X? ( >=media-libs/libsdl-1.2.5 )"
27 RDEPEND="${DEPEND}"
28
29 # various module import and data path issues
30 RESTRICT=test
31
32 python_configure() {
33         PORTMIDI_INC_PORTTIME=1 LOCALBASE="${EPREFIX}/usr" \
34                 "${EPYTHON}" "${S}"/buildconfig/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 }