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 --- 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 +- 7 files changed, 13 insertions(+), 7 deletions(-) (limited to 'tools') 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