From 909c7f0677c6e570f88982bc63a8d53467d8972a Mon Sep 17 00:00:00 2001 From: classabbyamp Date: Wed, 27 Sep 2023 23:25:27 -0400 Subject: [PATCH] boswars: update to 2.8. --- srcpkgs/boswars/patches/python3.patch | 264 ++++++++++++++++++++++++++ srcpkgs/boswars/template | 24 +-- 2 files changed, 270 insertions(+), 18 deletions(-) create mode 100644 srcpkgs/boswars/patches/python3.patch diff --git a/srcpkgs/boswars/patches/python3.patch b/srcpkgs/boswars/patches/python3.patch new file mode 100644 index 00000000000..0289236e78a --- /dev/null +++ b/srcpkgs/boswars/patches/python3.patch @@ -0,0 +1,264 @@ +From 5cb645f8c55b536f0027314aac9216a200315708 Mon Sep 17 00:00:00 2001 +From: Francois Beerten +Date: Wed, 5 Jul 2023 10:39:48 +0200 +Subject: [PATCH] fabricate.py: remove deprecated calls to + os.stat_float_times() + +Since Python 2.5, stat times use floats and we require at least +Python 2.7. os.stat_float_times() is deprecated since Python +3.1 and has been completely removed in Python 3.7. + +References in Python doc and issue tracker: +* https://docs.python.org/3/whatsnew/changelog.html?highlight=stat_float_times#id409 +* https://bugs.python.org/issue31827 + +This fixes one of the bugs detected by Luiz Gabriel Jung in bug #64375 +"Can't run new game version 2.8". +--- + fabricate.py | 5 ----- + 1 file changed, 5 deletions(-) + +diff --git a/fabricate.py b/fabricate.py +index d63901d3..8fe46002 100644 +--- a/fabricate.py ++++ b/fabricate.py +@@ -378,10 +378,6 @@ class AtimesRunner(Runner): + """ Run command and return its dependencies and outputs, using before + and after access times to determine dependencies. """ + +- # For Python pre-2.5, ensure os.stat() returns float atimes +- old_stat_float = os.stat_float_times() +- os.stat_float_times(True) +- + originals = self.file_times() + if self.atimes == 2: + befores = originals +@@ -425,7 +421,6 @@ class AtimesRunner(Runner): + if original != afters.get(name, None): + self._utime(name, original[0], original[1]) + +- os.stat_float_times(old_stat_float) # restore stat_float_times value + return deps, outputs + + class StraceProcess(object): +From bcc21c1c6373a793e9cdff781b9644c6da8a7091 Mon Sep 17 00:00:00 2001 +From: Alexandre Detiste +Date: Mon, 10 Jul 2023 13:39:04 +0200 +Subject: [PATCH 1/2] make the scripts compatible with both Python 2 & 3 + +the 'from future import ...' can be removed +when it's time to remove Python2 compatibility +--- + doc/scripts/findlua.py | 10 ++++++---- + doc/scripts/showindex.py | 3 ++- + languages/makesame.py | 6 ++++-- + tools/installers/createpackages.py | 5 +++-- + tools/unitstats.py | 8 +++++--- + 5 files changed, 20 insertions(+), 12 deletions(-) + +diff --git a/doc/scripts/findlua.py b/doc/scripts/findlua.py +index 67d674de..4a8b2848 100755 +--- a/doc/scripts/findlua.py ++++ b/doc/scripts/findlua.py +@@ -1,9 +1,11 @@ + #!/usr/bin/env python + "Output all lua functions defined in the engine source code." + ++from __future__ import print_function ++ + import os +-import os, sys +-from stat import * ++import sys ++from stat import ST_MODE, S_ISDIR, S_ISREG + + # where to find the other stratagus tools + toolpath = os.path.dirname(sys.argv[0]) + '/' +@@ -23,7 +25,7 @@ def walktree(top, callback): + callback(pathname) + else: + # Unknown file type, print a message +- print 'Skipping %s' % pathname ++ print('Skipping %s' % pathname) + + commands = [] + reffiles = {} +@@ -43,5 +45,5 @@ if __name__ == '__main__': + + commands.sort() + for command in commands: +- print command ++ print(command) + +diff --git a/doc/scripts/showindex.py b/doc/scripts/showindex.py +index 82b22783..f582643e 100755 +--- a/doc/scripts/showindex.py ++++ b/doc/scripts/showindex.py +@@ -3,6 +3,7 @@ + Usefull to check if all functions are documented. + """ + ++from __future__ import print_command + import os + + commands = [] +@@ -18,4 +19,4 @@ for infile in os.listdir('.'): + commands.sort() + + for command in commands: +- print command ++ print(command) +diff --git a/languages/makesame.py b/languages/makesame.py +index 99ef0f83..43cd36fd 100644 +--- a/languages/makesame.py ++++ b/languages/makesame.py +@@ -25,8 +25,8 @@ + + import sys + +-f = file(sys.argv[1]) +-out = file(sys.argv[2], "wt") ++f = open(sys.argv[1]) ++out = open(sys.argv[2], "wt") + + for line in f: + if line.startswith("msgid "): +@@ -37,3 +37,5 @@ for line in f: + else: + out.write(line) + ++f.close() ++out.close() +diff --git a/tools/installers/createpackages.py b/tools/installers/createpackages.py +index 0ba84816..a0288008 100755 +--- a/tools/installers/createpackages.py ++++ b/tools/installers/createpackages.py +@@ -21,6 +21,7 @@ + ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ## GNU General Public License for more details. + ++from __future__ import print_function + import sys + import os + import tarfile +@@ -43,7 +44,7 @@ def createTarArchive(archivename, namelist): + printDot() + tar.addfile(tarinfo, open(name, 'rb')) + tar.close() +- print ++ print() + + def createZipArchive(archivename, namelist): + print("\nCreating %s.zip" % archivename) +@@ -52,7 +53,7 @@ def createZipArchive(archivename, namelist): + z.write(name, archivename + "/" + name) + printDot() + z.close() +- print ++ print() + + def listGitFiles(): + entries = os.popen('git ls-files').readlines() +diff --git a/tools/unitstats.py b/tools/unitstats.py +index 4da3816a..c0419882 100755 +--- a/tools/unitstats.py ++++ b/tools/unitstats.py +@@ -19,6 +19,8 @@ + # but WITHOUT ANY WARRANTY; without even the implied warranty of + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU General Public License for more details. ++ ++from __future__ import print_function + import os + import sys + import csv +@@ -192,10 +194,10 @@ def updateUnitStats(units): + stats = readUnitStats() + for unit in units: + name = unit.stats['Name'] +- if stats.has_key(name): ++ if name in stats: + up = stats[name] + for k in up.keys(): +- if unit.stats.has_key(k) and k != 'Name': ++ if k in unit.stats and k != 'Name': + unit.stats[k] = removeCommas(up[k]) + + Usage = """ +@@ -211,7 +213,7 @@ Usage = """ + delimiter and single quote (') as string quote. + """ + def printUsage(args): +- print Usage % args[0] ++ print(Usage % args[0]) + + def main(args): + if len(args) == 1: +-- +2.30.8 + + +From fd11f87f55114a033731321c6faa9e5d22224b8b Mon Sep 17 00:00:00 2001 +From: Alexandre Detiste +Date: Mon, 10 Jul 2023 13:51:41 +0200 +Subject: [PATCH 2/2] make the scripts python3-only + +--- + doc/scripts/findlua.py | 2 -- + doc/scripts/showindex.py | 1 - + tools/installers/createpackages.py | 1 - + tools/unitstats.py | 1 - + 4 files changed, 5 deletions(-) + +diff --git a/doc/scripts/findlua.py b/doc/scripts/findlua.py +index 4a8b2848..5bc0d376 100755 +--- a/doc/scripts/findlua.py ++++ b/doc/scripts/findlua.py +@@ -1,8 +1,6 @@ + #!/usr/bin/env python + "Output all lua functions defined in the engine source code." + +-from __future__ import print_function +- + import os + import sys + from stat import ST_MODE, S_ISDIR, S_ISREG +diff --git a/doc/scripts/showindex.py b/doc/scripts/showindex.py +index f582643e..0a8b78f0 100755 +--- a/doc/scripts/showindex.py ++++ b/doc/scripts/showindex.py +@@ -3,7 +3,6 @@ + Usefull to check if all functions are documented. + """ + +-from __future__ import print_command + import os + + commands = [] +diff --git a/tools/installers/createpackages.py b/tools/installers/createpackages.py +index a0288008..1ec39016 100755 +--- a/tools/installers/createpackages.py ++++ b/tools/installers/createpackages.py +@@ -21,7 +21,6 @@ + ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ## GNU General Public License for more details. + +-from __future__ import print_function + import sys + import os + import tarfile +diff --git a/tools/unitstats.py b/tools/unitstats.py +index c0419882..eedd2fec 100755 +--- a/tools/unitstats.py ++++ b/tools/unitstats.py +@@ -20,7 +20,6 @@ + # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + # GNU General Public License for more details. + +-from __future__ import print_function + import os + import sys + import csv +-- +2.30.8 + diff --git a/srcpkgs/boswars/template b/srcpkgs/boswars/template index 5f16f8cbbf0..42c097d1dcd 100644 --- a/srcpkgs/boswars/template +++ b/srcpkgs/boswars/template @@ -1,8 +1,8 @@ # Template file for 'boswars' pkgname=boswars -version=2.7 -revision=6 -hostmakedepends="pkg-config libpng-progs python" +version=2.8 +revision=1 +hostmakedepends="pkg-config libpng-progs python3" makedepends="SDL-devel glu-devel libpng-devel libtheora-devel libvorbis-devel lua51-devel" depends="${pkgname}-data" short_desc="Futuristic real-time strategy game (RTS)" @@ -10,20 +10,8 @@ maintainer="Orphaned " license="GPL-2.0-or-later" homepage="https://www.boswars.org" distfiles="https://www.boswars.org/dist/releases/boswars-${version}-src.tar.gz" -checksum=dc3718f531e9ea413cf37e1333b62a4c5e69f1405502d9c59b9e424635135e3e -python_version=2 - -post_extract() { - #png bugfix for version 2.7, https://savannah.nongnu.org/bugs/?39610 - - for i in $(find . -iname '*.png'); do - pngfix -q ${i} || { - echo "Fixing ${i}" - pngfix -q --out=${i/.png/_fixed.png} ${i} || : #ignore exit code - pngfix -q ${i/.png/_fixed.png} && mv ${i/.png/_fixed.png} ${i}; - } - done -} +checksum=5185206990bf6765c7a5d3802ce6e6048a1087cf4c307b099a5691a3eec6b86a +python_version=3 do_build() { # Patch make.py to respect our $CXXFLAGS and $LDFLAGS @@ -32,7 +20,7 @@ do_build() { -e "/^gccflags.*/a gldflags = '${LDFLAGS}'.split()" \ -e "s;self.ldflags = list(ldflags);self.ldflags = gldflags + list(ldflags);" \ -e "s/cc='g++'/cc='$CXX'/" - python2 make.py + python3 make.py } do_install() {