summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-03-09 22:20:23 +0100
committerRémi Verschelde <rverschelde@gmail.com>2024-03-09 22:20:23 +0100
commit0ace0a129284ffc6646b199699c1607a316fcec0 (patch)
tree82c37d0f9c972396d0031fc757a33fc35576af5d /modules
parent7d6ae138fa7064270ee61fed747a11780c2f1c0f (diff)
parentd9fa40f2df44d775e82332577d44de402b23611f (diff)
downloadredot-engine-0ace0a129284ffc6646b199699c1607a316fcec0.tar.gz
Merge pull request #89333 from Repiteo/enforce-eol-python
Enforce `\n` eol for Python writes
Diffstat (limited to 'modules')
-rw-r--r--modules/modules_builders.py4
-rwxr-xr-xmodules/mono/build_scripts/build_assemblies.py4
-rw-r--r--modules/raycast/godot_update_embree.py8
-rw-r--r--modules/text_server_adv/SCsub2
-rw-r--r--modules/text_server_adv/gdextension_build/methods.py4
-rw-r--r--modules/text_server_fb/gdextension_build/methods.py4
6 files changed, 14 insertions, 12 deletions
diff --git a/modules/modules_builders.py b/modules/modules_builders.py
index 13d5a2075a..20eea9d993 100644
--- a/modules/modules_builders.py
+++ b/modules/modules_builders.py
@@ -7,7 +7,7 @@ from platform_methods import subprocess_main
def generate_modules_enabled(target, source, env):
- with open(target[0].path, "w") as f:
+ with open(target[0].path, "w", encoding="utf-8", newline="\n") as f:
for module in env.module_list:
f.write("#define %s\n" % ("MODULE_" + module.upper() + "_ENABLED"))
@@ -15,7 +15,7 @@ def generate_modules_enabled(target, source, env):
def generate_modules_tests(target, source, env):
import os
- with open(target[0].path, "w") as f:
+ with open(target[0].path, "w", encoding="utf-8", newline="\n") as f:
for header in source:
f.write('#include "%s"\n' % (os.path.normpath(header.path)))
diff --git a/modules/mono/build_scripts/build_assemblies.py b/modules/mono/build_scripts/build_assemblies.py
index aa6f6ef05e..9ed87c7a8c 100755
--- a/modules/mono/build_scripts/build_assemblies.py
+++ b/modules/mono/build_scripts/build_assemblies.py
@@ -312,7 +312,7 @@ def generate_sdk_package_versions():
)
# We write in ../SdkPackageVersions.props.
- with open(os.path.join(dirname(script_path), "SdkPackageVersions.props"), "w", encoding="utf-8") as f:
+ with open(os.path.join(dirname(script_path), "SdkPackageVersions.props"), "w", encoding="utf-8", newline="\n") as f:
f.write(props)
f.close()
@@ -340,7 +340,7 @@ def generate_sdk_package_versions():
)
os.makedirs(generators_dir, exist_ok=True)
- with open(os.path.join(generators_dir, "Common.Constants.cs"), "w", newline="\n", encoding="utf-8") as f:
+ with open(os.path.join(generators_dir, "Common.Constants.cs"), "w", encoding="utf-8", newline="\n") as f:
f.write(constants)
f.close()
diff --git a/modules/raycast/godot_update_embree.py b/modules/raycast/godot_update_embree.py
index 527e02f855..0e62824adc 100644
--- a/modules/raycast/godot_update_embree.py
+++ b/modules/raycast/godot_update_embree.py
@@ -96,7 +96,7 @@ for f in all_files:
os.makedirs(d)
shutil.copy2(f, d)
-with open(os.path.join(dest_dir, "kernels/hash.h"), "w") as hash_file:
+with open(os.path.join(dest_dir, "kernels/hash.h"), "w", encoding="utf-8", newline="\n") as hash_file:
hash_file.write(
f"""// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
@@ -105,7 +105,7 @@ with open(os.path.join(dest_dir, "kernels/hash.h"), "w") as hash_file:
"""
)
-with open(os.path.join(dest_dir, "kernels/config.h"), "w") as config_file:
+with open(os.path.join(dest_dir, "kernels/config.h"), "w", encoding="utf-8", newline="\n") as config_file:
config_file.write(
"""// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
@@ -193,7 +193,9 @@ with open("CMakeLists.txt", "r") as cmake_file:
minor_version = int(re.compile(r"EMBREE_VERSION_MINOR\s(\d+)").findall(cmake_content)[0])
patch_version = int(re.compile(r"EMBREE_VERSION_PATCH\s(\d+)").findall(cmake_content)[0])
-with open(os.path.join(dest_dir, "include/embree3/rtcore_config.h"), "w") as config_file:
+with open(
+ os.path.join(dest_dir, "include/embree3/rtcore_config.h"), "w", encoding="utf-8", newline="\n"
+) as config_file:
config_file.write(
f"""// Copyright 2009-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
diff --git a/modules/text_server_adv/SCsub b/modules/text_server_adv/SCsub
index 09d9b2dd67..79950eaac3 100644
--- a/modules/text_server_adv/SCsub
+++ b/modules/text_server_adv/SCsub
@@ -9,7 +9,7 @@ env_text_server_adv = env_modules.Clone()
def make_icu_data(target, source, env):
dst = target[0].srcnode().abspath
- g = open(dst, "w", encoding="utf-8")
+ g = open(dst, "w", encoding="utf-8", newline="\n")
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("/* (C) 2016 and later: Unicode, Inc. and others. */\n")
diff --git a/modules/text_server_adv/gdextension_build/methods.py b/modules/text_server_adv/gdextension_build/methods.py
index 327097a3df..8456149973 100644
--- a/modules/text_server_adv/gdextension_build/methods.py
+++ b/modules/text_server_adv/gdextension_build/methods.py
@@ -83,7 +83,7 @@ def disable_warnings(self):
def make_icu_data(target, source, env):
dst = target[0].srcnode().abspath
- g = open(dst, "w", encoding="utf-8")
+ g = open(dst, "w", encoding="utf-8", newline="\n")
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("/* (C) 2016 and later: Unicode, Inc. and others. */\n")
@@ -108,7 +108,7 @@ def make_icu_data(target, source, env):
def write_macos_plist(target, binary_name, identifier, name):
os.makedirs(f"{target}/Resource/", exist_ok=True)
- f = open(f"{target}/Resource/Info.plist", "w")
+ f = open(f"{target}/Resource/Info.plist", "w", encoding="utf-8", newline="\n")
f.write(f'<?xml version="1.0" encoding="UTF-8"?>\n')
f.write(f'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n')
diff --git a/modules/text_server_fb/gdextension_build/methods.py b/modules/text_server_fb/gdextension_build/methods.py
index 327097a3df..8456149973 100644
--- a/modules/text_server_fb/gdextension_build/methods.py
+++ b/modules/text_server_fb/gdextension_build/methods.py
@@ -83,7 +83,7 @@ def disable_warnings(self):
def make_icu_data(target, source, env):
dst = target[0].srcnode().abspath
- g = open(dst, "w", encoding="utf-8")
+ g = open(dst, "w", encoding="utf-8", newline="\n")
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("/* (C) 2016 and later: Unicode, Inc. and others. */\n")
@@ -108,7 +108,7 @@ def make_icu_data(target, source, env):
def write_macos_plist(target, binary_name, identifier, name):
os.makedirs(f"{target}/Resource/", exist_ok=True)
- f = open(f"{target}/Resource/Info.plist", "w")
+ f = open(f"{target}/Resource/Info.plist", "w", encoding="utf-8", newline="\n")
f.write(f'<?xml version="1.0" encoding="UTF-8"?>\n')
f.write(f'<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n')