diff options
author | Freeyorp <TheFreeYorp+git@gmail.com> | 2024-06-04 14:15:47 +0000 |
---|---|---|
committer | Freeyorp <TheFreeYorp+git@gmail.com> | 2024-06-04 14:15:47 +0000 |
commit | 53051b7cace8db3ec948349e0538e393e4af6860 (patch) | |
tree | 0b390a2248d446293b35f3d038fea91c08b83fbf /tools/debug-debug-scripts | |
parent | 1841311e6302ff88e53446744e571bed703d2087 (diff) | |
download | tmwa-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/debug-debug-scripts')
-rwxr-xr-x | tools/debug-debug-scripts | 8 |
1 files changed, 7 insertions, 1 deletions
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 = {} |