SCons: Use default env["ENV"] and prepend PATH to it

This fixes a regression from #46774 where `env["ENV"]` would miss some
important env variables on Windows, such as `SystemRoot`, `PATHEXT`, etc.

So we go back to the previous setup (letting SCons initialize `env["ENV"]`
as it sees fit for the host OS) but use `PrependENVPath` instead of
`AppendENVPath` to preserve the intended fix from #46774.

Fixes #46790 for 3.2.
This commit is contained in:
Rémi Verschelde 2021-03-09 09:32:30 +01:00
parent 0ddba5b712
commit 0431241935

View file

@ -61,14 +61,15 @@ elif platform_arg == "javascript":
# Use generic POSIX build toolchain for Emscripten. # Use generic POSIX build toolchain for Emscripten.
custom_tools = ["cc", "c++", "ar", "link", "textfile", "zip"] custom_tools = ["cc", "c++", "ar", "link", "textfile", "zip"]
env_base = Environment( # We let SCons build its default ENV as it includes OS-specific things which we don't
ENV={ # want to have to pull in manually.
"PATH": os.getenv("PATH"), # Then we prepend PATH to make it take precedence, while preserving SCons' own entries.
"PKG_CONFIG_PATH": os.getenv("PKG_CONFIG_PATH"), env_base = Environment(tools=custom_tools)
"TERM": os.getenv("TERM"), env_base.PrependENVPath("PATH", os.getenv("PATH"))
}, env_base.PrependENVPath("PKG_CONFIG_PATH", os.getenv("PKG_CONFIG_PATH"))
tools=custom_tools, if "TERM" in os.environ: # Used for colored output.
) env_base["ENV"]["TERM"] = os.environ["TERM"]
env_base.disabled_modules = [] env_base.disabled_modules = []
env_base.use_ptrcall = False env_base.use_ptrcall = False
env_base.module_version_string = "" env_base.module_version_string = ""