commit:     7976e453eea2bb1c0fb2a404a5b70b976594bb97
Author:     Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 16 16:33:06 2017 +0000
Commit:     Andrew Savchenko <bircoph <AT> gentoo <DOT> org>
CommitDate: Sun Jul 16 16:33:06 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7976e453

games-engines/renpy: fix compat support for old games

- Katawa Shoujo, see bug 601200: check for window to be on list before removal
- Elven Relations: do not create removed style elements

Package-Manager: Portage-2.3.6, Repoman-2.3.2
Signed-off-by: Andrew Savchenko <bircoph <AT> gentoo.org>

 .../renpy/files/renpy-6.99.12.4-compat-style.patch |  43 ++++++++
 .../files/renpy-6.99.12.4-compat-window.patch      |  51 +++++++++
 games-engines/renpy/renpy-6.99.12.4-r1.ebuild      | 116 +++++++++++++++++++++
 3 files changed, 210 insertions(+)

diff --git a/games-engines/renpy/files/renpy-6.99.12.4-compat-style.patch 
b/games-engines/renpy/files/renpy-6.99.12.4-compat-style.patch
new file mode 100644
index 00000000000..122ebf1e43e
--- /dev/null
+++ b/games-engines/renpy/files/renpy-6.99.12.4-compat-style.patch
@@ -0,0 +1,43 @@
+commit 1d350d993d2b51df7880e92b48ed103e059ec385
+Author: Andrew Savchenko <birc...@gmail.com>
+Date:   Sun Jul 16 17:07:27 2017 +0300
+
+    Fix compatibility problem With ElvenRelations-1.2:
+    
+    When starting game:
+    
+    Full traceback:
+      File "/home/andrew/src/_compat/styles.rpymc", line 22, in script
+      File "/usr/lib64/python2.7/site-packages/renpy699/renpy/ast.py", line 
814, in execute
+        renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, 
store=self.store)
+      File "/usr/lib64/python2.7/site-packages/renpy699/renpy/python.py", line 
1719, in py_exec_bytecode
+        exec bytecode in globals, locals
+      File "renpy/common/_compat/styles.rpym", line 374, in <module>
+        style.selected_button = _SelectedCompat('button')
+      File "renpy/common/_compat/styles.rpym", line 347, in __init__
+        self.target = target
+      File "renpy/style.pyx", line 378, in renpy.style.StyleCore.__setattr__ 
(gen/renpy.style.c:6236)
+        raise Exception("Style property {} is not known.".format(name))
+    Exception: Style property target is not known.
+    
+    "button*" properties are no longer present in RenPy, so relevant
+    code is removed.
+
+diff --git a/renpy/common/_compat/styles.rpym 
b/renpy/common/_compat/styles.rpym
+index d83eeb0..174f0b6 100644
+--- a/renpy/common/_compat/styles.rpym
++++ b/renpy/common/_compat/styles.rpym
+@@ -371,13 +371,6 @@ init python:
+             self.property_updates = [ ]
+ 
+ 
+-    style.selected_button = _SelectedCompat('button')
+-    style.selected_button_text = _SelectedCompat('button_text')
+-    style.gm_nav_selected_button = _SelectedCompat('gm_nav_button')
+-    style.gm_nav_selected_button_text = _SelectedCompat('gm_nav_button_text')
+-    style.prefs_selected_button = _SelectedCompat('prefs_button')
+-    style.prefs_selected_button_text = _SelectedCompat('prefs_button_text')
+-
+     def _apply_selected_compat():
+         for scs in _selected_compat:
+             scs.apply()

diff --git a/games-engines/renpy/files/renpy-6.99.12.4-compat-window.patch 
b/games-engines/renpy/files/renpy-6.99.12.4-compat-window.patch
new file mode 100644
index 00000000000..8c8bd21b4f6
--- /dev/null
+++ b/games-engines/renpy/files/renpy-6.99.12.4-compat-window.patch
@@ -0,0 +1,51 @@
+commit cf3f7fd4cb69c154f43a5e00c7501463a6d63ff5
+Author: Andrew Savchenko <birc...@gmail.com>
+Date:   Sun Jul 16 16:59:14 2017 +0300
+
+    Fix compatibility problem with Katawa Shoujo 1.3.1
+    
+    The game fails to start with renpy-6.99.12.4:
+    
+    I'm sorry, but an uncaught exception occurred.
+    
+    While running game code:
+      File "game/ui_settings.rpy", line 21, in <module>
+      File "renpy/common/00compat.rpy", line 134, in _set_script_version
+        config.window_auto_hide.remove("call screen")
+    ValueError: list.remove(x): x not in list
+    
+    -- Full Traceback 
------------------------------------------------------------
+    
+    Full traceback:
+      File "/home/rondo/ui_settings.rpyc", line 2, in script
+      File "/usr/lib64/python2.7/site-packages/renpy699/renpy/ast.py", line 
814, in execute
+        renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, 
store=self.store)
+      File "/usr/lib64/python2.7/site-packages/renpy699/renpy/python.py", line 
1695, in py_exec_bytecode
+        exec bytecode in globals, locals
+      File "game/ui_settings.rpy", line 21, in <module>
+      File 
"/usr/lib64/python2.7/site-packages/renpy699/renpy/defaultstore.py", line 92, 
in __setattr__
+        renpy.store._set_script_version(value)  # E1101 @UndefinedVariable
+      File "renpy/common/00compat.rpy", line 134, in _set_script_version
+        config.window_auto_hide.remove("call screen")
+      File "/usr/lib64/python2.7/site-packages/renpy699/renpy/python.py", line 
610, in do_mutation
+        return method(self, *args, **kwargs)
+    ValueError: list.remove(x): x not in list
+    
+    This happens because "call screen" element is being unconditionally
+    removed from config.window_auto_hide list, though it is not always
+    present there. A simple if check fixes this.
+
+diff --git a/renpy/common/00compat.rpy b/renpy/common/00compat.rpy
+index c16ad1d..eefb8e0 100644
+--- a/renpy/common/00compat.rpy
++++ b/renpy/common/00compat.rpy
+@@ -131,7 +131,8 @@ init -1900 python:
+         if version <= (6, 99, 10):
+             config.new_translate_order = False
+             config.old_say_args = True
+-            config.window_auto_hide.remove("call screen")
++            if "call screen" in config.window_auto_hide:
++                config.window_auto_hide.remove("call screen")
+             config.quit_action = ui.gamemenus("_quit_prompt")
+             config.enforce_window_max_size = False
+             config.splashscreen_suppress_overlay = False

diff --git a/games-engines/renpy/renpy-6.99.12.4-r1.ebuild 
b/games-engines/renpy/renpy-6.99.12.4-r1.ebuild
new file mode 100644
index 00000000000..8049f87073f
--- /dev/null
+++ b/games-engines/renpy/renpy-6.99.12.4-r1.ebuild
@@ -0,0 +1,116 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+PYTHON_COMPAT=( python2_7 )
+DISTUTILS_IN_SOURCE_BUILD=1
+inherit eutils games gnome2-utils toolchain-funcs versionator distutils-r1
+
+DESCRIPTION="Visual novel engine written in python"
+HOMEPAGE="http://www.renpy.org";
+SRC_URI="http://www.renpy.org/dl/${PV}/${P}-source.tar.bz2";
+
+LICENSE="MIT"
+SLOT="$(get_version_component_range 1-2)"
+MYSLOT=$(delete_all_version_separators ${SLOT})
+KEYWORDS="~amd64 ~x86"
+IUSE="development doc examples"
+REQUIRED_USE="examples? ( development )"
+
+RDEPEND="
+       >=app-eselect/eselect-renpy-0.6
+       dev-libs/fribidi
+       ~dev-python/pygame_sdl2-${PV}[${PYTHON_USEDEP}]
+       >=dev-lang/python-exec-0.3[${PYTHON_USEDEP}]
+       media-libs/glew:0
+       media-libs/libpng:0
+       media-libs/libsdl2[video]
+       media-libs/freetype:2
+       sys-libs/zlib
+       virtual/ffmpeg"
+DEPEND="${RDEPEND}
+       dev-python/cython[${PYTHON_USEDEP}]
+       virtual/pkgconfig"
+
+S=${WORKDIR}/${P}-source
+
+PATCHES=(
+       "${FILESDIR}"/${P}-multiple-abi.patch
+       "${FILESDIR}"/${P}-compat-window.patch #601200
+       "${FILESDIR}"/${P}-compat-style.patch
+)
+
+pkg_setup() {
+       games_pkg_setup
+       export CFLAGS="${CFLAGS} $($(tc-getPKG_CONFIG) --cflags fribidi)"
+}
+
+python_prepare_all() {
+       distutils-r1_python_prepare_all
+
+       einfo "Deleting precompiled python files"
+       find . -name '*.py[co]' -print -delete || die
+
+       sed -i \
+               -e "s/@SLOT@/${MYSLOT}/" \
+               renpy.py renpy/common.py || die "setting slot failed!"
+}
+
+python_compile() {
+       cd "${S}"/module || die
+       distutils-r1_python_compile
+}
+
+python_install() {
+       cd "${S}"/module || die
+       distutils-r1_python_install 
--install-lib="$(python_get_sitedir)/renpy${MYSLOT}"
+
+       cd "${S}" || die
+       python_scriptinto "${GAMES_BINDIR}"
+       python_newscript renpy.py ${PN}-${SLOT}
+
+       python_moduleinto renpy${MYSLOT}
+       python_domodule renpy
+       if use development ; then
+               python_domodule launcher templates
+       fi
+       if use examples ; then
+               python_domodule the_question tutorial
+       fi
+}
+
+python_install_all() {
+       distutils-r1_python_install_all
+       if use development; then
+               newicon -s 32 launcher/game/images/logo32.png ${P}.png
+               make_desktop_entry ${PN}-${SLOT} "Ren'Py ${PV}" ${P}
+       fi
+
+       if use doc; then
+               insinto html
+               doins -r doc
+       fi
+       newman "${FILESDIR}/${PN}.1" "${P}.1"
+
+       prepgamesdirs
+}
+
+pkg_preinst() {
+       games_pkg_preinst
+       use development && gnome2_icon_savelist
+}
+
+pkg_postinst() {
+       games_pkg_postinst
+       use development && gnome2_icon_cache_update
+
+       einfo "running: eselect renpy update --if-unset"
+       eselect renpy update --if-unset
+}
+
+pkg_postrm() {
+       use development && gnome2_icon_cache_update
+
+       einfo "running: eselect renpy update --if-unset"
+       eselect renpy update --if-unset
+}

Reply via email to