build.plat: allow spaces in environment variables on Windows.
Specifically, allow spaces in: - set AMARANTH_ENV_<toolchain>=c:\program files\... - set <tool>=c:\program files\...
This commit is contained in:
parent
77dab7884c
commit
c1666adf30
|
@ -184,7 +184,8 @@ class TemplatedPlatform(Platform):
|
|||
"build_{{name}}.bat": """
|
||||
@rem {{autogenerated}}
|
||||
{{quiet("@echo off")}}
|
||||
if defined {{platform._toolchain_env_var}} call %{{platform._toolchain_env_var}}%
|
||||
SetLocal EnableDelayedExpansion
|
||||
if defined {{platform._toolchain_env_var}} call "%{{platform._toolchain_env_var}}%"
|
||||
{{emit_commands("bat")}}
|
||||
""",
|
||||
}
|
||||
|
@ -283,8 +284,8 @@ class TemplatedPlatform(Platform):
|
|||
template = ": ${{{env_var}:={name}}}"
|
||||
elif syntax == "bat":
|
||||
template = \
|
||||
"if [%{env_var}%] equ [\"\"] set {env_var}=\n" \
|
||||
"if [%{env_var}%] equ [] set {env_var}={name}"
|
||||
"if [!{env_var}!] equ [\"\"] set {env_var}=\n" \
|
||||
"if [!{env_var}!] equ [] set {env_var}={name}"
|
||||
else:
|
||||
assert False
|
||||
commands.append(template.format(env_var=env_var, name=name))
|
||||
|
@ -308,7 +309,7 @@ class TemplatedPlatform(Platform):
|
|||
if context.parent["syntax"] == "sh":
|
||||
return f"\"${env_var}\""
|
||||
elif context.parent["syntax"] == "bat":
|
||||
return f"%{env_var}%"
|
||||
return f"\"%{env_var}%\""
|
||||
else:
|
||||
assert False
|
||||
|
||||
|
|
Loading…
Reference in a new issue