commit:     4900137dde22ca34250c4de54fb1d2ec3e569170
Author:     Vadim Misbakh-Soloviov <mva <AT> gentoo <DOT> org>
AuthorDate: Tue Jan 16 04:21:43 2024 +0000
Commit:     Vadim Misbakh-Soloviov <mva <AT> gentoo <DOT> org>
CommitDate: Tue Jan 16 04:24:30 2024 +0000
URL:        https://gitweb.gentoo.org/proj/gamerlay.git/commit/?id=4900137d

games-strategy/unknown-horizons: fix build

Closes: https://bugs.gentoo.org/905123
Signed-off-by: Vadim Misbakh-Soloviov <mva <AT> gentoo.org>

 .../unknown-horizons/files/json_decoder.patch        |  8 ++++++++
 .../unknown-horizons/files/python-3.8.patch          | 19 +++++++++++++++++++
 .../unknown-horizons/files/unitmanager.patch         | 20 ++++++++++++++++++++
 .../unknown-horizons/files/util_preloader.patch      | 14 ++++++++++++++
 games-strategy/unknown-horizons/metadata.xml         | 14 +++++++-------
 ...19.1.ebuild => unknown-horizons-2019.1-r1.ebuild} | 17 +++++++++++++++--
 6 files changed, 83 insertions(+), 9 deletions(-)

diff --git a/games-strategy/unknown-horizons/files/json_decoder.patch 
b/games-strategy/unknown-horizons/files/json_decoder.patch
new file mode 100644
index 0000000..bb355a4
--- /dev/null
+++ b/games-strategy/unknown-horizons/files/json_decoder.patch
@@ -0,0 +1,8 @@
+--- a/horizons/util/loaders/jsondecoder.py     2019-01-12 16:15:42.000000000 
+0100
++++ b/horizons/util/loaders/jsondecoder.py     2022-09-04 02:23:14.570074926 
+0200
+@@ -37,4 +37,4 @@
+                       return newdict
+ 
+               with open(path, "r") as f:
+-                      return json.load(f, encoding="ascii", 
object_hook=_decode_dict)
++                      return json.loads(f.read().encode("ascii"), 
object_hook=_decode_dict)

diff --git a/games-strategy/unknown-horizons/files/python-3.8.patch 
b/games-strategy/unknown-horizons/files/python-3.8.patch
new file mode 100644
index 0000000..f994250
--- /dev/null
+++ b/games-strategy/unknown-horizons/files/python-3.8.patch
@@ -0,0 +1,19 @@
+--- a/setup.py 2022-09-01 12:49:18.429156294 +0200
++++ b/setup.py 2022-09-01 12:55:09.679161589 +0200
+@@ -26,6 +26,7 @@
+ import json
+ import os
+ import platform
++import distro
+ import sys
+ from distutils.command.build import build
+ from distutils.core import setup
+@@ -39,7 +40,7 @@
+ # Ensure we are in the correct directory
+ os.chdir(os.path.realpath(os.path.dirname(__file__)))
+ 
+-if platform.dist()[0].lower() in ('debian', 'ubuntu'):
++if distro.id().lower() in ('debian', 'ubuntu'):
+       executable_path = 'games'
+ else:
+       executable_path = 'bin'

diff --git a/games-strategy/unknown-horizons/files/unitmanager.patch 
b/games-strategy/unknown-horizons/files/unitmanager.patch
new file mode 100644
index 0000000..901ea64
--- /dev/null
+++ b/games-strategy/unknown-horizons/files/unitmanager.patch
@@ -0,0 +1,20 @@
+--- a/horizons/ai/aiplayer/combat/unitmanager.py       2019-01-12 
16:15:42.000000000 +0100
++++ b/horizons/ai/aiplayer/combat/unitmanager.py       2022-09-04 
03:17:12.660088944 +0200
+@@ -151,7 +151,7 @@
+               """
+               Rule stating that ship has to be in any of given states.
+               """
+-              if not isinstance(ship_states, collections.Iterable):
++              if not isinstance(ship_states, collections.abc.Iterable):
+                       ship_states = (ship_states,)
+               return lambda ship: (state_dict[ship] in ship_states)
+ 
+@@ -178,7 +178,7 @@
+               @param rules: conditions each ship has to meet (AND)
+               @type rules: iterable of lambda(ship) or single lambda(ship)
+               """
+-              if not isinstance(rules, collections.Iterable):
++              if not isinstance(rules, collections.abc.Iterable):
+                       rules = (rules,)
+               return [ship for ship in ships if all((rule(ship) for rule in 
rules))]
+ 

diff --git a/games-strategy/unknown-horizons/files/util_preloader.patch 
b/games-strategy/unknown-horizons/files/util_preloader.patch
new file mode 100644
index 0000000..c584f26
--- /dev/null
+++ b/games-strategy/unknown-horizons/files/util_preloader.patch
@@ -0,0 +1,14 @@
+--- a/horizons/util/preloader.py       2019-01-12 16:15:42.000000000 +0100
++++ b/horizons/util/preloader.py       2022-09-04 02:18:05.000073586 +0200
+@@ -79,9 +79,9 @@
+               """
+               self.lock.acquire()
+               # wait until it finished its current action
+-              if self.isAlive():
++              if self.is_alive():
+                       self.join()
+-                      assert not self.isAlive()
++                      assert not self.is_alive()
+               else:
+                       try:
+                               self.lock.release()

diff --git a/games-strategy/unknown-horizons/metadata.xml 
b/games-strategy/unknown-horizons/metadata.xml
index 7a6f11a..5df3482 100644
--- a/games-strategy/unknown-horizons/metadata.xml
+++ b/games-strategy/unknown-horizons/metadata.xml
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
 <pkgmetadata>
-       <maintainer type="person">
-               <email>toty...@unknown-horizons.org</email>
-               <name>totycro</name>
-       </maintainer>
-       <longdescription>Anno-like real time strategy game</longdescription>
-       <use>
-       </use>
+  <maintainer type="person">
+    <email>toty...@unknown-horizons.org</email>
+    <name>totycro</name>
+  </maintainer>
+  <upstream>
+    <remote-id type="github">unknown-horizons/unknown-horizons</remote-id>
+  </upstream>
 </pkgmetadata>

diff --git a/games-strategy/unknown-horizons/unknown-horizons-2019.1.ebuild 
b/games-strategy/unknown-horizons/unknown-horizons-2019.1-r1.ebuild
similarity index 68%
rename from games-strategy/unknown-horizons/unknown-horizons-2019.1.ebuild
rename to games-strategy/unknown-horizons/unknown-horizons-2019.1-r1.ebuild
index 9bea365..6fcda6a 100644
--- a/games-strategy/unknown-horizons/unknown-horizons-2019.1.ebuild
+++ b/games-strategy/unknown-horizons/unknown-horizons-2019.1-r1.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2023 Gentoo Authors
+# Copyright 1999-2024 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 EAPI=8
 
-PYTHON_COMPAT=( python3_{9..11} )
+PYTHON_COMPAT=( python3_{9..12} )
 DISTUTILS_SINGLE_IMPL=1
 PYTHON_REQ_USE="sqlite"
 
@@ -18,6 +18,8 @@ KEYWORDS="~amd64 ~x86"
 SLOT="0"
 IUSE="test"
 
+RESTRICT="!test? ( test )"
+
 RDEPEND="
        dev-python/pyyaml
        dev-python/pillow
@@ -40,14 +42,25 @@ DEPEND="
 
 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
 
+PATCHES=(
+       "${FILESDIR}/python-3.8.patch"
+       "${FILESDIR}/util_preloader.patch"
+       "${FILESDIR}/json_decoder.patch"
+       "${FILESDIR}/unitmanager.patch"
+)
+
 src_test() {
        ${PYTHON} ./run_tests.py
 }
 
 src_compile() {
        distutils-r1_src_compile build_i18n
+       chmod +x horizons/engine/generate_atlases.py
+       horizons/engine/generate_atlases.py 2048
 }
 
 src_install() {
        distutils-r1_src_install
+       insinto "/usr/share/unknown-horizons/content"
+       doins "content/atlas.sql"
 }

Reply via email to