diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2020-03-25 14:36:03 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-03-25 15:25:37 +0100 |
commit | 3d2dd79ecd2c8456ba9401f6b12333d01f61e13e (patch) | |
tree | 945849b824e902a49bb3d7acb4bf13f76a1850f8 /editor | |
parent | 35e700e931f565aa37040055126fa61f02424ae0 (diff) |
SCons: Drop support for Python 2
We now require SCons 3.0+ (first version with Python 3 support),
and we set min required Python 3 version to 3.5 (3.4 and earlier are
EOL).
Diffstat (limited to 'editor')
-rw-r--r-- | editor/SCsub | 5 | ||||
-rw-r--r-- | editor/editor_builders.py | 17 | ||||
-rw-r--r-- | editor/icons/editor_icons_builders.py | 3 |
3 files changed, 12 insertions, 13 deletions
diff --git a/editor/SCsub b/editor/SCsub index 6e8679b770..61562d70d3 100644 --- a/editor/SCsub +++ b/editor/SCsub @@ -7,13 +7,12 @@ env.editor_sources = [] import os import os.path from platform_methods import run_in_subprocess -from compat import open_utf8 import editor_builders def _make_doc_data_class_path(to_path): # NOTE: It is safe to generate this file here, since this is still executed serially - g = open_utf8(os.path.join(to_path, "doc_data_class_path.gen.h"), "w") + g = open(os.path.join(to_path, "doc_data_class_path.gen.h"), "w", encoding="utf-8") g.write("static const int _doc_data_class_path_count = " + str(len(env.doc_class_path)) + ";\n") g.write("struct _DocDataClassPath { const char* name; const char* path; };\n") @@ -37,7 +36,7 @@ if env['tools']: reg_exporters += '}\n' # NOTE: It is safe to generate this file here, since this is still executed serially - with open_utf8("register_exporters.gen.cpp", "w") as f: + with open("register_exporters.gen.cpp", "w", encoding="utf-8") as f: f.write(reg_exporters_inc) f.write(reg_exporters) diff --git a/editor/editor_builders.py b/editor/editor_builders.py index e8c23acf9e..44c3e50dfc 100644 --- a/editor/editor_builders.py +++ b/editor/editor_builders.py @@ -6,24 +6,23 @@ All such functions are invoked in a subprocess on Windows to prevent build flaki import os import os.path from platform_methods import subprocess_main -from compat import encode_utf8, byte_to_str, open_utf8 def make_doc_header(target, source, env): dst = target[0] - g = open_utf8(dst, "w") + g = open(dst, "w", encoding="utf-8") buf = "" docbegin = "" docend = "" for src in source: if not src.endswith(".xml"): continue - with open_utf8(src, "r") as f: + with open(src, "r", encoding="utf-8") as f: content = f.read() buf += content - buf = encode_utf8(docbegin + buf + docend) + buf = (docbegin + buf + docend).encode("utf-8") decomp_size = len(buf) import zlib buf = zlib.compress(buf) @@ -35,7 +34,7 @@ def make_doc_header(target, source, env): g.write("static const int _doc_data_uncompressed_size = " + str(decomp_size) + ";\n") g.write("static const unsigned char _doc_data_compressed[] = {\n") for i in range(len(buf)): - g.write("\t" + byte_to_str(buf[i]) + ",\n") + g.write("\t" + str(buf[i]) + ",\n") g.write("};\n") g.write("#endif") @@ -47,7 +46,7 @@ def make_fonts_header(target, source, env): dst = target[0] - g = open_utf8(dst, "w") + g = open(dst, "w", encoding="utf-8") g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("#ifndef _EDITOR_FONTS_H\n") @@ -64,7 +63,7 @@ def make_fonts_header(target, source, env): g.write("static const int _font_" + name + "_size = " + str(len(buf)) + ";\n") g.write("static const unsigned char _font_" + name + "[] = {\n") for j in range(len(buf)): - g.write("\t" + byte_to_str(buf[j]) + ",\n") + g.write("\t" + str(buf[j]) + ",\n") g.write("};\n") @@ -77,7 +76,7 @@ def make_translations_header(target, source, env, category): dst = target[0] - g = open_utf8(dst, "w") + g = open(dst, "w", encoding="utf-8") g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n") g.write("#ifndef _{}_TRANSLATIONS_H\n".format(category.upper())) @@ -98,7 +97,7 @@ def make_translations_header(target, source, env, category): g.write("static const unsigned char _{}_translation_{}_compressed[] = {{\n".format(category, name)) for j in range(len(buf)): - g.write("\t" + byte_to_str(buf[j]) + ",\n") + g.write("\t" + str(buf[j]) + ",\n") g.write("};\n") diff --git a/editor/icons/editor_icons_builders.py b/editor/icons/editor_icons_builders.py index ea2c2e57d1..a00f21c265 100644 --- a/editor/icons/editor_icons_builders.py +++ b/editor/icons/editor_icons_builders.py @@ -3,9 +3,10 @@ All such functions are invoked in a subprocess on Windows to prevent build flakiness. """ + import os +from io import StringIO from platform_methods import subprocess_main -from compat import StringIO def make_editor_icons_action(target, source, env): |