unknown-horizons: several patches from upstream for Python 3.9+.

(also fix distfiles complaining about "Multiple Choices" as well)
This commit is contained in:
Joel Beckmeyer 2022-02-25 21:46:02 -05:00 committed by Andrew J. Hesford
parent 04d887f784
commit c7cc6451c5
3 changed files with 65 additions and 2 deletions

View file

@ -0,0 +1,22 @@
diff --git a/horizons/ai/aiplayer/combat/unitmanager.py b/horizons/ai/aiplayer/combat/unitmanager.py
index 8449d55..57db0d4 100644
--- a/horizons/ai/aiplayer/combat/unitmanager.py
+++ b/horizons/ai/aiplayer/combat/unitmanager.py
@@ -151,7 +151,7 @@ class UnitManager:
"""
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 @@ class UnitManager:
@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))]

View file

@ -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 ea2ddfb330..138a948f42 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 5689cc6815..2e072fcc64 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()

View file

@ -1,7 +1,7 @@
# Template file for 'unknown-horizons'
pkgname=unknown-horizons
version=2019.1
revision=6
revision=7
build_style=python3-module
hostmakedepends="python3 intltool git python3-Pillow"
depends="python3 fifengine python3-yaml"
@ -9,7 +9,7 @@ short_desc="2D real time strategy simulation"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later, MIT, BSD-3-Clause, CC-BY-3.0, CC-BY-SA-3.0, OFL-1.0"
homepage="https://unknown-horizons.org"
distfiles="https://github.com/unknown-horizons/unknown-horizons/archive/${version}.tar.gz"
distfiles="https://github.com/unknown-horizons/unknown-horizons/archive/refs/tags/${version}.tar.gz"
checksum=a417fd3d342212fd190e4f21be82ef13c10e1ed7c288fbbe46e46200cf3de4d8
pre_install() {