summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorFreeyorp <TheFreeYorp+git@gmail.com>2024-06-04 14:15:47 +0000
committerFreeyorp <TheFreeYorp+git@gmail.com>2024-06-04 14:15:47 +0000
commit53051b7cace8db3ec948349e0538e393e4af6860 (patch)
tree0b390a2248d446293b35f3d038fea91c08b83fbf /tools
parent1841311e6302ff88e53446744e571bed703d2087 (diff)
downloadtmwa-53051b7cace8db3ec948349e0538e393e4af6860.tar.gz
tmwa-53051b7cace8db3ec948349e0538e393e4af6860.tar.bz2
tmwa-53051b7cace8db3ec948349e0538e393e4af6860.tar.xz
tmwa-53051b7cace8db3ec948349e0538e393e4af6860.zip
Very basic python3 support
Extremely minimal, not touching any __future__ imports or such. For serious use, see specing's WIP PR at: https://git.themanaworld.org/legacy/tmwa/-/merge_requests/256
Diffstat (limited to 'tools')
-rwxr-xr-xtools/bs-align2
-rwxr-xr-xtools/colorize2
-rwxr-xr-xtools/config.py2
-rwxr-xr-xtools/debug-debug-scripts8
-rwxr-xr-xtools/indenter2
-rwxr-xr-xtools/pp-indent2
-rwxr-xr-xtools/protocol.py2
7 files changed, 13 insertions, 7 deletions
diff --git a/tools/bs-align b/tools/bs-align
index 6582298..0caf649 100755
--- a/tools/bs-align
+++ b/tools/bs-align
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- encoding: utf-8
## bs-align.py - Filter to align trailing line continuations
##
diff --git a/tools/colorize b/tools/colorize
index ce6f410..849fb61 100755
--- a/tools/colorize
+++ b/tools/colorize
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
from __future__ import print_function
diff --git a/tools/config.py b/tools/config.py
index f87fe77..a2645d8 100755
--- a/tools/config.py
+++ b/tools/config.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# coding: utf-8
# config.py - generator for config file parsers
diff --git a/tools/debug-debug-scripts b/tools/debug-debug-scripts
index 2112a6e..cfdc31f 100755
--- a/tools/debug-debug-scripts
+++ b/tools/debug-debug-scripts
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# encoding: utf-8
from __future__ import print_function
@@ -35,6 +35,12 @@ error = False
def eprint(s):
print('Error:', s, file=sys.stderr)
+# Implement an equivalent to Python 2's execfile for Python 3
+def execfile(filename, globals=None, locals=None):
+ with open(filename, 'r') as f:
+ code = compile(f.read(), filename, 'exec')
+ exec(code, globals, locals)
+
def get_classes_from_file(a):
global error
d = {}
diff --git a/tools/indenter b/tools/indenter
index 0d93543..f7c1657 100755
--- a/tools/indenter
+++ b/tools/indenter
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- encoding: utf-8
## indenter.py - Top-level indenter for all files
##
diff --git a/tools/pp-indent b/tools/pp-indent
index 9be9a03..622614a 100755
--- a/tools/pp-indent
+++ b/tools/pp-indent
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# -*- encoding: utf-8
## pp-indent - Filter to apply indentation to preprocessor statements
##
diff --git a/tools/protocol.py b/tools/protocol.py
index cf89a16..d63c22d 100755
--- a/tools/protocol.py
+++ b/tools/protocol.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
# coding: utf-8
# protocol.py - generator for entire TMWA network protocol