From 53051b7cace8db3ec948349e0538e393e4af6860 Mon Sep 17 00:00:00 2001 From: Freeyorp Date: Tue, 4 Jun 2024 14:15:47 +0000 Subject: 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 --- .gitmodules | 2 +- configure | 2 +- deps/attoconf | 2 +- tools/bs-align | 2 +- tools/colorize | 2 +- tools/config.py | 2 +- tools/debug-debug-scripts | 8 +++++++- tools/indenter | 2 +- tools/pp-indent | 2 +- tools/protocol.py | 2 +- 10 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.gitmodules b/.gitmodules index 8197e60..48c5d1f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "deps/attoconf"] path = deps/attoconf - url = https://github.com/o11c/attoconf.git + url = https://github.com/Freeyorp/attoconf [submodule "deps/googletest"] path = deps/googletest url = https://github.com/google/googletest.git diff --git a/configure b/configure index aa1d0fd..275a9c4 100755 --- a/configure +++ b/configure @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # Copyright 2013 Ben Longbons # diff --git a/deps/attoconf b/deps/attoconf index 7b939e7..f8844ed 160000 --- a/deps/attoconf +++ b/deps/attoconf @@ -1 +1 @@ -Subproject commit 7b939e7e4ce36e8b62b10025e567f871731cbf4d +Subproject commit f8844ed8f37189396a3c6589909a33673ce6bc78 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 -- cgit v1.2.3-70-g09d2