You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-06 12:20:30 +00:00
Enforce \n eol for Python writes
• Ensure utf-8 encoding if previously unspecified
This commit is contained in:
24
methods.py
24
methods.py
@@ -230,7 +230,7 @@ def generate_version_header(module_version_string=""):
|
||||
|
||||
# NOTE: It is safe to generate these files here, since this is still executed serially.
|
||||
|
||||
f = open("core/version_generated.gen.h", "w")
|
||||
f = open("core/version_generated.gen.h", "w", encoding="utf-8", newline="\n")
|
||||
f.write(
|
||||
"""/* THIS FILE IS GENERATED DO NOT EDIT */
|
||||
#ifndef VERSION_GENERATED_GEN_H
|
||||
@@ -253,7 +253,7 @@ def generate_version_header(module_version_string=""):
|
||||
)
|
||||
f.close()
|
||||
|
||||
fhash = open("core/version_hash.gen.cpp", "w")
|
||||
fhash = open("core/version_hash.gen.cpp", "w", encoding="utf-8", newline="\n")
|
||||
fhash.write(
|
||||
"""/* THIS FILE IS GENERATED DO NOT EDIT */
|
||||
#include "core/version.h"
|
||||
@@ -384,7 +384,7 @@ def is_module(path):
|
||||
|
||||
|
||||
def write_disabled_classes(class_list):
|
||||
f = open("core/disabled_classes.gen.h", "w")
|
||||
f = open("core/disabled_classes.gen.h", "w", encoding="utf-8", newline="\n")
|
||||
f.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
|
||||
f.write("#ifndef DISABLED_CLASSES_GEN_H\n")
|
||||
f.write("#define DISABLED_CLASSES_GEN_H\n\n")
|
||||
@@ -435,7 +435,7 @@ void uninitialize_modules(ModuleInitializationLevel p_level) {
|
||||
)
|
||||
|
||||
# NOTE: It is safe to generate this file here, since this is still executed serially
|
||||
with open("modules/register_module_types.gen.cpp", "w") as f:
|
||||
with open("modules/register_module_types.gen.cpp", "w", encoding="utf-8", newline="\n") as f:
|
||||
f.write(modules_cpp)
|
||||
|
||||
|
||||
@@ -757,7 +757,7 @@ def generate_cpp_hint_file(filename):
|
||||
pass
|
||||
else:
|
||||
try:
|
||||
with open(filename, "w") as fd:
|
||||
with open(filename, "w", encoding="utf-8", newline="\n") as fd:
|
||||
fd.write("#define GDCLASS(m_class, m_inherits)\n")
|
||||
except OSError:
|
||||
print("Could not write cpp.hint file.")
|
||||
@@ -1062,7 +1062,7 @@ def show_progress(env):
|
||||
def progress_finish(target, source, env):
|
||||
nonlocal node_count, progressor
|
||||
try:
|
||||
with open(node_count_fname, "w") as f:
|
||||
with open(node_count_fname, "w", encoding="utf-8", newline="\n") as f:
|
||||
f.write("%d\n" % node_count)
|
||||
progressor.delete(progressor.file_list())
|
||||
except Exception:
|
||||
@@ -1092,7 +1092,7 @@ def dump(env):
|
||||
def non_serializable(obj):
|
||||
return "<<non-serializable: %s>>" % (type(obj).__qualname__)
|
||||
|
||||
with open(".scons_env.json", "w") as f:
|
||||
with open(".scons_env.json", "w", encoding="utf-8", newline="\n") as f:
|
||||
dump(env.Dictionary(), f, indent=4, default=non_serializable)
|
||||
|
||||
|
||||
@@ -1294,7 +1294,7 @@ def generate_vs_project(env, original_args, project_name="godot"):
|
||||
|
||||
filters_template = filters_template.replace("%%HASH%%", md5)
|
||||
|
||||
with open(f"{project_name}.vcxproj.filters", "w") as f:
|
||||
with open(f"{project_name}.vcxproj.filters", "w", encoding="utf-8", newline="\n") as f:
|
||||
f.write(filters_template)
|
||||
|
||||
envsources = []
|
||||
@@ -1469,7 +1469,9 @@ def generate_vs_project(env, original_args, project_name="godot"):
|
||||
cmd = " ^& ".join(common_build_prefix + [" ".join([commands] + cmd_clean)])
|
||||
props_template = props_template.replace("%%CLEAN%%", cmd)
|
||||
|
||||
with open(f"{project_name}.{platform}.{target}.{arch}.generated.props", "w") as f:
|
||||
with open(
|
||||
f"{project_name}.{platform}.{target}.{arch}.generated.props", "w", encoding="utf-8", newline="\n"
|
||||
) as f:
|
||||
f.write(props_template)
|
||||
|
||||
proj_uuid = str(uuid.uuid4())
|
||||
@@ -1572,7 +1574,7 @@ def generate_vs_project(env, original_args, project_name="godot"):
|
||||
proj_template = proj_template.replace("%%DEFAULT_ITEMS%%", "\n ".join(all_items))
|
||||
proj_template = proj_template.replace("%%PROPERTIES%%", "\n ".join(properties))
|
||||
|
||||
with open(f"{project_name}.vcxproj", "w") as f:
|
||||
with open(f"{project_name}.vcxproj", "w", encoding="utf-8", newline="\n") as f:
|
||||
f.write(proj_template)
|
||||
|
||||
if not get_bool(original_args, "vsproj_props_only", False):
|
||||
@@ -1583,7 +1585,7 @@ def generate_vs_project(env, original_args, project_name="godot"):
|
||||
sln_template = sln_template.replace("%%SECTION1%%", "\n ".join(section1))
|
||||
sln_template = sln_template.replace("%%SECTION2%%", "\n ".join(section2))
|
||||
|
||||
with open(f"{project_name}.sln", "w") as f:
|
||||
with open(f"{project_name}.sln", "w", encoding="utf-8", newline="\n") as f:
|
||||
f.write(sln_template)
|
||||
|
||||
if get_bool(original_args, "vsproj_gen_only", True):
|
||||
|
||||
Reference in New Issue
Block a user