diff options
Diffstat (limited to 'methods.py')
-rw-r--r-- | methods.py | 68 |
1 files changed, 41 insertions, 27 deletions
diff --git a/methods.py b/methods.py index 65b88a5c65..6bd93cb3f5 100644 --- a/methods.py +++ b/methods.py @@ -10,7 +10,7 @@ from io import StringIO, TextIOWrapper from pathlib import Path from typing import Generator, List, Optional, Union -# Get the "Godot" folder name ahead of time +# Get the "Redot" folder name ahead of time base_folder_path = str(os.path.abspath(Path(__file__).parent)) + "/" base_folder_only = os.path.basename(os.path.normpath(base_folder_path)) # Listing all the folders we have converted @@ -210,18 +210,30 @@ def get_version_info(module_version_string="", silent=False): "minor": int(version.minor), "patch": int(version.patch), "status": str(version.status), + "status_version": int(version.status_version if version.status != "stable" else 0), "build": str(build_name), "module_config": str(version.module_config) + module_version_string, "website": str(version.website), "docs_branch": str(version.docs), + "godot_major": str(version.godot_major), + "godot_minor": str(version.godot_minor), + "godot_patch": str(version.godot_patch), + "godot_status": str(version.godot_status), } # For dev snapshots (alpha, beta, RC, etc.) we do not commit status change to Git, # so this define provides a way to override it without having to modify the source. if os.getenv("GODOT_VERSION_STATUS") is not None: - version_info["status"] = str(os.getenv("GODOT_VERSION_STATUS")) + version_status_str = str(os.getenv("GODOT_VERSION_STATUS")) + if "." in version_status_str: + version_status_str = version_status_str.split(".") + version_info["status_version"] = int(version_status_str[1]) + version_status_str = version_status_str[0] + version_info["status"] = version_status_str if not silent: - print(f"Using version status '{version_info['status']}', overriding the original '{version.status}'.") + print( + f"Using version status '{version_info['status']}.{version_info['status_version']}', overriding the original '{version.status}.{version.status_version}'." + ) # Parse Git hash if we're in a Git repo. githash = "" @@ -348,7 +360,7 @@ def detect_modules(search_path, recursive=False): version_path = os.path.join(path, "version.py") if os.path.exists(version_path): with open(version_path, "r", encoding="utf-8") as f: - if 'short_name = "godot"' in f.read(): + if 'short_name = "redot"' in f.read(): return True return False @@ -556,7 +568,7 @@ def detect_visual_c_compiler_version(tools_env): # "x86" Native 32 bit compiler # "x86_amd64" 32 bit Cross Compiler for 64 bit - # There are other architectures, but Godot does not support them currently, so this function does not detect arm/amd64_arm + # There are other architectures, but Redot does not support them currently, so this function does not detect arm/amd64_arm # and similar architectures/compilers # Set chosen compiler to "not detected" @@ -1087,7 +1099,7 @@ def dump(env): # # To generate AND build from the command line: # scons vsproj=yes vsproj_gen_only=no -def generate_vs_project(env, original_args, project_name="godot"): +def generate_vs_project(env, original_args, project_name="redot"): # Augmented glob_recursive that also fills the dirs argument with traversed directories that have content. def glob_recursive_2(pattern, dirs, node="."): from SCons import Node @@ -1369,7 +1381,7 @@ def generate_vs_project(env, original_args, project_name="godot"): vsconf = f'{target}|{a["platform"]}' break - condition = "'$(GodotConfiguration)|$(GodotPlatform)'=='" + vsconf + "'" + condition = "'$(RedotConfiguration)|$(RedotPlatform)'=='" + vsconf + "'" itemlist = {} for item in activeItems: key = os.path.dirname(item).replace("\\", "_") @@ -1382,7 +1394,7 @@ def generate_vs_project(env, original_args, project_name="godot"): properties.append( "<ActiveProjectItemList_%s>;%s;</ActiveProjectItemList_%s>" % (x, ";".join(itemlist[x]), x) ) - output = f'bin\\godot{env["PROGSUFFIX"]}' + output = f'bin\\redot{env["PROGSUFFIX"]}' with open("misc/msvs/props.template", "r", encoding="utf-8") as file: props_template = file.read() @@ -1475,43 +1487,43 @@ def generate_vs_project(env, original_args, project_name="godot"): section1 = [] section2 = [] for conf in confs: - godot_platform = conf["platform"] + redot_platform = conf["platform"] for p in conf["arches"]: sln_plat = p["platform"] proj_plat = sln_plat - godot_arch = p["architecture"] + redot_arch = p["architecture"] # Redirect editor configurations for non-Windows platforms to the Windows one, so the solution has all the permutations # and VS doesn't complain about missing project configurations. # These configurations are disabled, so they show up but won't build. - if godot_platform != "windows": + if redot_platform != "windows": section1 += [f"editor|{sln_plat} = editor|{proj_plat}"] section2 += [ f"{{{proj_uuid}}}.editor|{proj_plat}.ActiveCfg = editor|{proj_plat}", ] for t in conf["targets"]: - godot_target = t + redot_target = t # Windows x86 is a special little flower that requires a project platform == Win32 but a solution platform == x86. - if godot_platform == "windows" and godot_target == "editor" and godot_arch == "x86_32": + if redot_platform == "windows" and redot_target == "editor" and redot_arch == "x86_32": sln_plat = "x86" configurations += [ - f'<ProjectConfiguration Include="{godot_target}|{proj_plat}">', - f" <Configuration>{godot_target}</Configuration>", + f'<ProjectConfiguration Include="{redot_target}|{proj_plat}">', + f" <Configuration>{redot_target}</Configuration>", f" <Platform>{proj_plat}</Platform>", "</ProjectConfiguration>", ] properties += [ - f"<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='{godot_target}|{proj_plat}'\">", - f" <GodotConfiguration>{godot_target}</GodotConfiguration>", - f" <GodotPlatform>{proj_plat}</GodotPlatform>", + f"<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='{redot_target}|{proj_plat}'\">", + f" <RedotConfiguration>{redot_target}</RedotConfiguration>", + f" <RedotPlatform>{proj_plat}</RedotPlatform>", "</PropertyGroup>", ] - if godot_platform != "windows": + if redot_platform != "windows": configurations += [ f'<ProjectConfiguration Include="editor|{proj_plat}">', " <Configuration>editor</Configuration>", @@ -1521,21 +1533,21 @@ def generate_vs_project(env, original_args, project_name="godot"): properties += [ f"<PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='editor|{proj_plat}'\">", - " <GodotConfiguration>editor</GodotConfiguration>", - f" <GodotPlatform>{proj_plat}</GodotPlatform>", + " <RedotConfiguration>editor</RedotConfiguration>", + f" <RedotPlatform>{proj_plat}</RedotPlatform>", "</PropertyGroup>", ] - p = f"{project_name}.{godot_platform}.{godot_target}.{godot_arch}.generated.props" + p = f"{project_name}.{redot_platform}.{redot_target}.{redot_arch}.generated.props" imports += [ f'<Import Project="$(MSBuildProjectDirectory)\\{p}" Condition="Exists(\'$(MSBuildProjectDirectory)\\{p}\')"/>' ] - section1 += [f"{godot_target}|{sln_plat} = {godot_target}|{sln_plat}"] + section1 += [f"{redot_target}|{sln_plat} = {redot_target}|{sln_plat}"] section2 += [ - f"{{{proj_uuid}}}.{godot_target}|{sln_plat}.ActiveCfg = {godot_target}|{proj_plat}", - f"{{{proj_uuid}}}.{godot_target}|{sln_plat}.Build.0 = {godot_target}|{proj_plat}", + f"{{{proj_uuid}}}.{redot_target}|{sln_plat}.ActiveCfg = {redot_target}|{proj_plat}", + f"{{{proj_uuid}}}.{redot_target}|{sln_plat}.Build.0 = {redot_target}|{proj_plat}", ] # Add an extra import for a local user props file at the end, so users can add more overrides. @@ -1580,9 +1592,11 @@ def generate_copyright_header(filename: str) -> str: /* %s*/ /**************************************************************************/ /* This file is part of: */ -/* GODOT ENGINE */ -/* https://godotengine.org */ +/* REDOT ENGINE */ +/* https://redotengine.org */ /**************************************************************************/ +/* Copyright (c) 2024-present Redot Engine contributors */ +/* (see REDOT_AUTHORS.md). */ /* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */ /* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* */ |