diff options
author | Ionen Wolkens <ionen@gentoo.org> | 2021-06-05 00:56:18 -0400 |
---|---|---|
committer | Ionen Wolkens <ionen@gentoo.org> | 2021-06-05 01:03:59 -0400 |
commit | 0528696360252c65b9ec1c42ad88c974cb104d90 (patch) | |
tree | d648866ba4c1c36579505e963470afea913bc8f1 /games-puzzle | |
parent | app-arch/makeself: version bump to 2.4.4 (diff) | |
download | gentoo-0528696360252c65b9ec1c42ad88c974cb104d90.tar.gz gentoo-0528696360252c65b9ec1c42ad88c974cb104d90.tar.bz2 gentoo-0528696360252c65b9ec1c42ad88c974cb104d90.zip |
games-puzzle/pathological: support pygame-2, tidy ebuild
- use patch to fix input events with pygame-2
- add sdl2-image[jpeg,png], pygame-1 ebuild would ensure
availability but not every games need this and so -2 doesn't
- check for sdl2-mixer[mod] in postinst over sdl-mixer using optfeature
- remove write-highscores as it's unused with debian patches and don't
want to change behavior after this long or break the patchset
- remove \xa9 sed (bug #162025), already fixed by debian patches
sdl2-* deps are invalid with pygame-1 but there's no real reason
to restrict to >=pygame-2 (still runs with 1) or complexify when
pygame-1 will have to be removed eventually.
Thanks to Samuel Bauer for pointing out inputs fix for pygame-2.
Closes: https://bugs.gentoo.org/794211
Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
Diffstat (limited to 'games-puzzle')
-rw-r--r-- | games-puzzle/pathological/files/pathological-1.1.3_p16-pygame2-compat.patch | 68 | ||||
-rw-r--r-- | games-puzzle/pathological/pathological-1.1.3_p16-r3.ebuild | 74 |
2 files changed, 142 insertions, 0 deletions
diff --git a/games-puzzle/pathological/files/pathological-1.1.3_p16-pygame2-compat.patch b/games-puzzle/pathological/files/pathological-1.1.3_p16-pygame2-compat.patch new file mode 100644 index 000000000000..525f30438e17 --- /dev/null +++ b/games-puzzle/pathological/files/pathological-1.1.3_p16-pygame2-compat.patch @@ -0,0 +1,68 @@ +These are integers and use of "is" with pygame-2 ignores input events. + +https://bugs.gentoo.org/794211 + +See also: pygame-2.0.1/buildconfig/pygame-stubs/constants.pyi +--- a/pathological.py ++++ b/pathological.py +@@ -133,3 +133,3 @@ + if colorkey is not None: +- if colorkey is -1: ++ if colorkey == -1: + colorkey = image.get_at((0,0)) +@@ -1395,6 +1395,6 @@ + for event in pygame.event.get(): +- if event.type is QUIT: ++ if event.type == QUIT: + return -4 +- elif event.type is KEYDOWN: +- if event.key is K_ESCAPE: return -3 ++ elif event.type == KEYDOWN: ++ if event.key == K_ESCAPE: return -3 + elif event.key == ord('n'): return 2 +@@ -1419,3 +1419,3 @@ + +- elif event.type is MOUSEBUTTONDOWN: ++ elif event.type == MOUSEBUTTONDOWN: + if self.paused: +@@ -1713,5 +1713,5 @@ + for event in pygame.event.get(): +- if event.type is QUIT: ++ if event.type == QUIT: + return -2 +- elif event.type is KEYDOWN: ++ elif event.type == KEYDOWN: + if event.key == K_ESCAPE: return -1 +@@ -1744,3 +1744,3 @@ + return 1 +- elif event.type is MOUSEBUTTONDOWN: ++ elif event.type == MOUSEBUTTONDOWN: + return 1 +@@ -1799,5 +1799,5 @@ + for event in pygame.event.get(): +- if event.type is QUIT: ++ if event.type == QUIT: + return None +- elif event.type is KEYUP: ++ elif event.type == KEYUP: + if event.key == K_LSHIFT: +@@ -1806,3 +1806,3 @@ + shift_state &= ~KMOD_RSHIFT +- elif event.type is KEYDOWN: ++ elif event.type == KEYDOWN: + if event.key == K_LSHIFT: +@@ -1994,3 +1994,3 @@ + for event in pygame.event.get(): +- if event.type is QUIT: ++ if event.type == QUIT: + if self.curpage == 1: +@@ -1999,3 +1999,3 @@ + return -2 +- elif event.type is KEYDOWN: ++ elif event.type == KEYDOWN: + if event.key == K_F2: +@@ -2032,3 +2032,3 @@ + continue +- elif event.type is MOUSEBUTTONDOWN: ++ elif event.type == MOUSEBUTTONDOWN: + if self.curpage == 1: diff --git a/games-puzzle/pathological/pathological-1.1.3_p16-r3.ebuild b/games-puzzle/pathological/pathological-1.1.3_p16-r3.ebuild new file mode 100644 index 000000000000..dc1f36d2d15d --- /dev/null +++ b/games-puzzle/pathological/pathological-1.1.3_p16-r3.ebuild @@ -0,0 +1,74 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( python3_{8,9} ) +inherit desktop optfeature python-single-r1 + +MY_P="${PN}-$(ver_cut 1-3)" + +DESCRIPTION="Enriched clone of the game 'Logical' by Rainbow Arts" +HOMEPAGE="https://pathological.sourceforge.net/" +SRC_URI=" + mirror://sourceforge/pathological/${MY_P}.tar.gz + mirror://debian/pool/main/p/pathological/${MY_P/-/_}-${PV/*_p}.debian.tar.xz" +S="${WORKDIR}/${MY_P}" + +LICENSE="GPL-2+" +SLOT="0" +KEYWORDS="~amd64 ~x86" +IUSE="doc" +REQUIRED_USE="${PYTHON_REQUIRED_USE}" + +RDEPEND=" + ${PYTHON_DEPS} + media-libs/sdl2-image[jpeg,png] + $(python_gen_cond_dep 'dev-python/pygame[${PYTHON_USEDEP}]')" +BDEPEND=" + ${PYTHON_DEPS} + doc? ( media-libs/netpbm[png] )" + +PATCHES=( + "${FILESDIR}"/${P}-pygame2-compat.patch +) + +src_prepare() { + # debian's patches add python3 support and sanitize other aspects + # use_ogg_music: excluded given .xm files are fine + local debian=($(<"${WORKDIR}"/debian/patches/series)) + debian=(${debian[@]/60_use_ogg_music.patch/}) + PATCHES+=("${debian[@]/#/${WORKDIR}/debian/patches/}") + + default + + sed -e "s|^cd .*/|cd ${EPREFIX}/usr/share/|" \ + -e "s|^exec|exec ${EPYTHON}|" \ + -i ${PN} || die + + gzip -d ${PN}.6.gz || die + rm graphics/*.xcf || die +} + +src_compile() { + use doc && emake docs +} + +src_install() { + dobin ${PN} + doman ${PN}.6 + + insinto /usr/share/${PN} + doins -r circuits graphics music sounds ${PN}.py + + doicon ${PN}.xpm + domenu "${WORKDIR}"/debian/${PN}.desktop + + use doc && local HTML_DOCS=( html/. ) + dodoc changelog + einstalldocs +} + +pkg_postinst() { + optfeature "background music support" "media-libs/sdl2-mixer[mod]" +} |