From 447d66341ccd24ee708fed2bba34353bbc1e549a Mon Sep 17 00:00:00 2001 From: Lukas Tenbrink Date: Wed, 20 Nov 2024 00:19:39 +0100 Subject: [PATCH] Move tools to site_scons/site_tools, which is the canonical scons tools directory. --- SConstruct | 4 +++- {tools => site_scons/site_tools}/android.py | 0 .../site_tools}/common_compiler_flags.py | 0 {tools => site_scons/site_tools}/godotcpp.py | 17 ++++++++--------- {tools => site_scons/site_tools}/ios.py | 0 {tools => site_scons/site_tools}/linux.py | 0 {tools => site_scons/site_tools}/macos.py | 0 {tools => site_scons/site_tools}/my_spawn.py | 0 {tools => site_scons/site_tools}/web.py | 0 {tools => site_scons/site_tools}/windows.py | 0 10 files changed, 11 insertions(+), 10 deletions(-) rename {tools => site_scons/site_tools}/android.py (100%) rename {tools => site_scons/site_tools}/common_compiler_flags.py (100%) rename {tools => site_scons/site_tools}/godotcpp.py (98%) rename {tools => site_scons/site_tools}/ios.py (100%) rename {tools => site_scons/site_tools}/linux.py (100%) rename {tools => site_scons/site_tools}/macos.py (100%) rename {tools => site_scons/site_tools}/my_spawn.py (100%) rename {tools => site_scons/site_tools}/web.py (100%) rename {tools => site_scons/site_tools}/windows.py (100%) diff --git a/SConstruct b/SConstruct index 8acea26245..538f84671c 100644 --- a/SConstruct +++ b/SConstruct @@ -27,7 +27,9 @@ if profile: elif os.path.isfile(profile + ".py"): customs.append(profile + ".py") opts = Variables(customs, ARGUMENTS) -cpp_tool = Tool("godotcpp", toolpath=["tools"]) +# Needed because if we're called as SConscript, our site_tools are not automatically appended to toolpath. +env.setdefault("toolpath", []).append("site_scons/site_tools") +cpp_tool = Tool("godotcpp", toolpath=env["toolpath"]) cpp_tool.options(opts, env) opts.Update(env) diff --git a/tools/android.py b/site_scons/site_tools/android.py similarity index 100% rename from tools/android.py rename to site_scons/site_tools/android.py diff --git a/tools/common_compiler_flags.py b/site_scons/site_tools/common_compiler_flags.py similarity index 100% rename from tools/common_compiler_flags.py rename to site_scons/site_tools/common_compiler_flags.py diff --git a/tools/godotcpp.py b/site_scons/site_tools/godotcpp.py similarity index 98% rename from tools/godotcpp.py rename to site_scons/site_tools/godotcpp.py index 77a0740fcd..85860b974a 100644 --- a/tools/godotcpp.py +++ b/site_scons/site_tools/godotcpp.py @@ -49,13 +49,6 @@ def validate_parent_dir(key, val, env): raise UserError("'%s' is not a directory: %s" % (key, os.path.dirname(val))) -def get_platform_tools_paths(env): - path = env.get("custom_tools", None) - if path is None: - return ["tools"] - return [normalize_path(path, env), "tools"] - - def get_custom_platforms(env): path = env.get("custom_tools", None) if path is None: @@ -189,6 +182,12 @@ def options(opts, env): opts.Update(env) + if env.get("toolpath", None) is None: + env["toolpath"] = [] # Some environments don't have setdefault yet :( + + if env.get("custom_tools", None) is not None: + env["toolpath"].append(normalize_path(env["custom_tools"], env)) + custom_platforms = get_custom_platforms(env) opts.Add( @@ -340,7 +339,7 @@ def options(opts, env): # Add platform options (custom tools can override platforms) for pl in sorted(set(platforms + custom_platforms)): - tool = Tool(pl, toolpath=get_platform_tools_paths(env)) + tool = Tool(pl, toolpath=env["toolpath"]) if hasattr(tool, "options"): tool.options(opts) @@ -451,7 +450,7 @@ def generate(env): env["optimize"] = ARGUMENTS.get("optimize", opt_level) env["debug_symbols"] = get_cmdline_bool("debug_symbols", env.dev_build) - tool = Tool(env["platform"], toolpath=get_platform_tools_paths(env)) + tool = Tool(env["platform"], toolpath=env["toolpath"]) if tool is None or not tool.exists(env): raise ValueError("Required toolchain not found for platform " + env["platform"]) diff --git a/tools/ios.py b/site_scons/site_tools/ios.py similarity index 100% rename from tools/ios.py rename to site_scons/site_tools/ios.py diff --git a/tools/linux.py b/site_scons/site_tools/linux.py similarity index 100% rename from tools/linux.py rename to site_scons/site_tools/linux.py diff --git a/tools/macos.py b/site_scons/site_tools/macos.py similarity index 100% rename from tools/macos.py rename to site_scons/site_tools/macos.py diff --git a/tools/my_spawn.py b/site_scons/site_tools/my_spawn.py similarity index 100% rename from tools/my_spawn.py rename to site_scons/site_tools/my_spawn.py diff --git a/tools/web.py b/site_scons/site_tools/web.py similarity index 100% rename from tools/web.py rename to site_scons/site_tools/web.py diff --git a/tools/windows.py b/site_scons/site_tools/windows.py similarity index 100% rename from tools/windows.py rename to site_scons/site_tools/windows.py