From 8a0c196f20a884a2152a2cfc241c4758ab38049d Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Fri, 25 Feb 2022 21:31:13 -0500 Subject: [PATCH 1/2] fifengine: patch from upstream to fix deprecation errors. Also add missing maintainer line in template --- .../remove_deprecated_getchildren.patch | 85 +++++++++++++++++++ srcpkgs/fifengine/template | 4 +- 2 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 srcpkgs/fifengine/patches/remove_deprecated_getchildren.patch diff --git a/srcpkgs/fifengine/patches/remove_deprecated_getchildren.patch b/srcpkgs/fifengine/patches/remove_deprecated_getchildren.patch new file mode 100644 index 000000000000..bea86cc39552 --- /dev/null +++ b/srcpkgs/fifengine/patches/remove_deprecated_getchildren.patch @@ -0,0 +1,85 @@ +From cf295fd98a8fba080f6305c27be56d10ab7ce94d Mon Sep 17 00:00:00 2001 +From: Lukas1818 +Date: Mon, 8 Feb 2021 20:34:19 +0100 +Subject: [PATCH] remove deprecated getchildren() + +--- + .../fife/extensions/serializers/simplexml.py | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/engine/python/fife/extensions/serializers/simplexml.py b/engine/python/fife/extensions/serializers/simplexml.py +index c4e10f4f8..d05567936 100644 +--- a/engine/python/fife/extensions/serializers/simplexml.py ++++ b/engine/python/fife/extensions/serializers/simplexml.py +@@ -200,7 +200,7 @@ def get(self, module, name, defaultValue=None): + #get the module tree: for example find tree under module FIFE + moduleTree = self._getModuleTree(module) + element = None +- for e in moduleTree.getchildren(): ++ for e in moduleTree: + if e.tag == "Setting" and e.get("name", "") == name: + element = e + break +@@ -275,7 +275,7 @@ def set(self, module, name, value, extra_attrs={}): + e_type = "str" + value = str(value) + +- for e in moduleTree.getchildren(): ++ for e in moduleTree: + if e.tag != "Setting": continue + if e.get("name", "") == name: + e.text = value +@@ -305,7 +305,7 @@ def remove(self, module, name): + + moduleTree = self._getModuleTree(module) + +- for e in moduleTree.getchildren(): ++ for e in moduleTree: + if e.tag != "Setting": continue + if e.get("name", "") == name: + moduleTree.remove(e) +@@ -321,7 +321,7 @@ def getModuleNameList(self): + self._initialized = True + + moduleNames = [] +- for c in self._root_element.getchildren(): ++ for c in self._root_element: + if c.tag == "Module": + name = c.get("name","") + if not isinstance(name, basestring): +@@ -344,7 +344,7 @@ def getAllSettings(self, module): + + # now from the tree read every value, and put the necessary values + # to the list +- for e in moduleTree.getchildren(): ++ for e in moduleTree: + if e.tag == "Setting": + name = e.get("name", "") + +@@ -383,7 +383,7 @@ def _validateTree(self): + + Raises an InvalidFormat exception if there is a format error. + """ +- for c in self._root_element.getchildren(): ++ for c in self._root_element: + if c.tag != "Module": + raise InvalidFormat("Invalid tag in " + self._file + \ + ". Expected Module, got: " + c.tag) +@@ -391,7 +391,7 @@ def _validateTree(self): + raise InvalidFormat("Invalid tag in " + self._file + \ + ". Module name is empty.") + else: +- for e in c.getchildren(): ++ for e in c: + if e.tag != "Setting": + raise InvalidFormat("Invalid tag in " + self._file + \ + " in module: " + c.tag + \ +@@ -414,7 +414,7 @@ def _getModuleTree(self, module): + raise AttributeError("Settings:_getModuleTree: Invalid type for " + "module argument.") + +- for c in self._root_element.getchildren(): ++ for c in self._root_element: + if c.tag == "Module" and c.get("name", "") == module: + return c + diff --git a/srcpkgs/fifengine/template b/srcpkgs/fifengine/template index 0b432258903e..1987e06f7d03 100644 --- a/srcpkgs/fifengine/template +++ b/srcpkgs/fifengine/template @@ -1,15 +1,15 @@ # Template file for 'fifengine' pkgname=fifengine version=0.4.2 -revision=7 +revision=8 build_style=cmake -pycompile_module="fife" hostmakedepends="swig python3" makedepends="SDL2-devel SDL2_image-devel SDL2_ttf-devel boost-devel libopenal-devel tinyxml-devel fifechan-devel python3-devel libXcursor-devel glew-devel" depends="python3-future" short_desc="Multi-platform isometric game engine" +maintainer="Orphaned " license="LGPL-2.1-or-later" homepage="https://github.com/fifengine/fifengine" distfiles="https://github.com/fifengine/fifengine/archive/${version}.tar.gz" From 250cf1fb090be245712b5ca2f84360373c806427 Mon Sep 17 00:00:00 2001 From: Joel Beckmeyer Date: Fri, 25 Feb 2022 21:46:02 -0500 Subject: [PATCH 2/2] unknown-horizons: several patches from upstream for Python 3.9+. (also fix distfiles complaining about "Multiple Choices" as well) --- .../patches/collections_Iterable.patch | 22 ++++++++++ srcpkgs/unknown-horizons/patches/py39.patch | 41 +++++++++++++++++++ srcpkgs/unknown-horizons/template | 4 +- 3 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 srcpkgs/unknown-horizons/patches/collections_Iterable.patch create mode 100644 srcpkgs/unknown-horizons/patches/py39.patch diff --git a/srcpkgs/unknown-horizons/patches/collections_Iterable.patch b/srcpkgs/unknown-horizons/patches/collections_Iterable.patch new file mode 100644 index 000000000000..0aab96e7b7a6 --- /dev/null +++ b/srcpkgs/unknown-horizons/patches/collections_Iterable.patch @@ -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))] + diff --git a/srcpkgs/unknown-horizons/patches/py39.patch b/srcpkgs/unknown-horizons/patches/py39.patch new file mode 100644 index 000000000000..f0422609df99 --- /dev/null +++ b/srcpkgs/unknown-horizons/patches/py39.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 +--- + 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() diff --git a/srcpkgs/unknown-horizons/template b/srcpkgs/unknown-horizons/template index 0eca01266be7..98b468f080e8 100644 --- a/srcpkgs/unknown-horizons/template +++ b/srcpkgs/unknown-horizons/template @@ -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 " 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() {