265 lines
7.7 KiB
Diff
265 lines
7.7 KiB
Diff
From 5cb645f8c55b536f0027314aac9216a200315708 Mon Sep 17 00:00:00 2001
|
|
From: Francois Beerten <fbeerten.git@b10eng.com>
|
|
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 <alexandre.detiste@gmail.com>
|
|
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 <alexandre.detiste@gmail.com>
|
|
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
|
|
|