unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: Simon South <simon@simonsouth.net>
To: 66173@debbugs.gnu.org
Subject: bug#66173: [PATCH 2/2] gnu: unknown-horizons: Fix build and runtime errors.
Date: Thu,  4 Jan 2024 15:33:56 -0500	[thread overview]
Message-ID: <90340dad1ea7d9f8e3cd4213684b503702cd20ad.1704399085.git.simon@simonsouth.net> (raw)
In-Reply-To: <cover.1704399085.git.simon@simonsouth.net>

Apply two upstream commits that allow building with Python 3.9 or newer and
running with Python 3.10.

* gnu/packages/patches/unknown-horizons-python-3.9.patch,
* gnu/packages/patches/unknown-horizons-python-3.10.patch: New files.
* gnu/local.mk (dist_patch_DATA): Add them.
* gnu/packages/games.scm (unknown-horizons)[source]: Apply them.

Change-Id: Icbc8b698b913be01465b09ab26afb29e5fd62a87
---
 gnu/local.mk                                  |  2 +
 gnu/packages/games.scm                        |  4 +-
 .../unknown-horizons-python-3.10.patch        | 32 +++++++++++++++
 .../patches/unknown-horizons-python-3.9.patch | 41 +++++++++++++++++++
 4 files changed, 78 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/unknown-horizons-python-3.10.patch
 create mode 100644 gnu/packages/patches/unknown-horizons-python-3.9.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index f66db809a9..bbde67cee2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2082,6 +2082,8 @@ dist_patch_DATA =						\
   %D%/packages/patches/ungoogled-chromium-system-ffmpeg.patch	\
   %D%/packages/patches/ungoogled-chromium-system-nspr.patch	\
   %D%/packages/patches/unknown-horizons-python-3.8-distro.patch	\
+  %D%/packages/patches/unknown-horizons-python-3.9.patch	\
+  %D%/packages/patches/unknown-horizons-python-3.10.patch	\
   %D%/packages/patches/unzip-CVE-2014-8139.patch		\
   %D%/packages/patches/unzip-CVE-2014-8140.patch		\
   %D%/packages/patches/unzip-CVE-2014-8141.patch		\
diff --git a/gnu/packages/games.scm b/gnu/packages/games.scm
index 333dbfcec5..880aebe0bb 100644
--- a/gnu/packages/games.scm
+++ b/gnu/packages/games.scm
@@ -4396,7 +4396,9 @@ (define-public unknown-horizons
               (sha256
                (base32
                 "1n747p7h0qp48szgp262swg0xh8kxy1bw8ag1qczs4i26hyzs5x4"))
-              (patches (search-patches "unknown-horizons-python-3.8-distro.patch"))))
+              (patches (search-patches "unknown-horizons-python-3.8-distro.patch"
+                                       "unknown-horizons-python-3.9.patch"
+                                       "unknown-horizons-python-3.10.patch"))))
     (build-system python-build-system)
     (arguments
      '(#:phases
diff --git a/gnu/packages/patches/unknown-horizons-python-3.10.patch b/gnu/packages/patches/unknown-horizons-python-3.10.patch
new file mode 100644
index 0000000000..599de1fec5
--- /dev/null
+++ b/gnu/packages/patches/unknown-horizons-python-3.10.patch
@@ -0,0 +1,32 @@
+From 4ff605d6c55fcf3e9b4777ffbcb0c24ef17ba4ca Mon Sep 17 00:00:00 2001
+From: Arti <artism90@googlemail.com>
+Date: Mon, 28 Feb 2022 21:19:50 +0100
+Subject: [PATCH] Rename instances of `collections.Iterable` into
+ `collections.abc.Iterable` (#2956)
+
+---
+ horizons/ai/aiplayer/combat/unitmanager.py | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/horizons/ai/aiplayer/combat/unitmanager.py b/horizons/ai/aiplayer/combat/unitmanager.py
+index 8449d5563c5..57db0d47061 100644
+--- a/horizons/ai/aiplayer/combat/unitmanager.py
++++ b/horizons/ai/aiplayer/combat/unitmanager.py
+@@ -151,7 +151,7 @@ def _ship_state_rule(self, state_dict, ship_states):
+ 		"""
+ 		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 @@ def filter_ships(self, ships, rules):
+ 		@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/gnu/packages/patches/unknown-horizons-python-3.9.patch b/gnu/packages/patches/unknown-horizons-python-3.9.patch
new file mode 100644
index 0000000000..8b93a71b6c
--- /dev/null
+++ b/gnu/packages/patches/unknown-horizons-python-3.9.patch
@@ -0,0 +1,41 @@
+From 7f6f613826aef9810999c1599c8354e8a78fbdb4 Mon Sep 17 00:00:00 2001
+From: Lukas1818 <44570204+Lukas1818@users.noreply.github.com>
+Date: Fri, 19 Feb 2021 21:08:44 +0100
+Subject: [PATCH] fixs for Phyton 3.9 (#2955)
+
+* change deprecated isAlive() to is_alive()
+
+* remove unsupported keyword "encoding"
+
+Co-authored-by: Lukas1818 <git@lukas1818.de>
+---
+ horizons/util/loaders/jsondecoder.py | 2 +-
+ horizons/util/preloader.py           | 4 ++--
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/horizons/util/loaders/jsondecoder.py b/horizons/util/loaders/jsondecoder.py
+index ea2ddfb3308..138a948f42a 100644
+--- a/horizons/util/loaders/jsondecoder.py
++++ b/horizons/util/loaders/jsondecoder.py
+@@ -37,4 +37,4 @@ def _decode_dict(dct):
+ 			return newdict
+ 
+ 		with open(path, "r") as f:
+-			return json.load(f, encoding="ascii", object_hook=_decode_dict)
++			return json.load(f, object_hook=_decode_dict)
+diff --git a/horizons/util/preloader.py b/horizons/util/preloader.py
+index 5689cc68152..2e072fcc642 100644
+--- a/horizons/util/preloader.py
++++ b/horizons/util/preloader.py
+@@ -79,9 +79,9 @@ def wait_for_finish(self):
+ 		"""
+ 		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()
-- 
2.41.0





  parent reply	other threads:[~2024-01-04 20:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-24  2:35 bug#66173: [BUG] Package unknown-horizons fails during build process Rodrigo Morales
2023-09-26 22:04 ` bug#66173: " Tobias Geerinckx-Rice via Bug reports for GNU Guix
2024-01-04 20:33 ` bug#66173: [PATCH 0/2] unknown-horizons: Fix build, runtime errors Simon South
2024-01-04 20:33   ` bug#66173: [PATCH 1/2] gnu: fifengine: Fix runtime error when using Python 3.9 or newer Simon South
2024-01-04 20:33   ` Simon South [this message]
2024-01-13 15:50 ` bug#66173: Package unknown-horizons fails during build process Simon South
2024-01-14 12:08   ` Liliana Marie Prikler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=90340dad1ea7d9f8e3cd4213684b503702cd20ad.1704399085.git.simon@simonsouth.net \
    --to=simon@simonsouth.net \
    --cc=66173@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).