From b8b8e0ba0b183403cc7fc012339b25771eae9e6e Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 13 Oct 2019 13:57:48 +0000 Subject: [PATCH] build.plat: fold emit_prelude() into emit_commands(). Commit a783e464 broke all toolchains using bash. --- nmigen/build/plat.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/nmigen/build/plat.py b/nmigen/build/plat.py index 65d5401..b99715b 100644 --- a/nmigen/build/plat.py +++ b/nmigen/build/plat.py @@ -247,14 +247,12 @@ class TemplatedPlatform(Platform): # {{autogenerated}} set -e{{verbose("x")}} [ -n "${{platform._toolchain_env_var}}" ] && . "${{platform._toolchain_env_var}}" - {{emit_prelude("sh")}} {{emit_commands("sh")}} """, "build_{{name}}.bat": """ @rem {{autogenerated}} {{quiet("@echo off")}} if defined {{platform._toolchain_env_var}} call %{{platform._toolchain_env_var}}% - {{emit_prelude("bat")}} {{emit_commands("bat")}} """, } @@ -288,8 +286,9 @@ class TemplatedPlatform(Platform): return verilog._convert_rtlil_text(rtlil_text, strip_internal_attrs=False, write_verilog_opts=opts) - def emit_prelude(syntax): + def emit_commands(syntax): commands = [] + for name in self.required_tools: env_var = tool_env_var(name) if syntax == "sh": @@ -301,10 +300,7 @@ class TemplatedPlatform(Platform): else: assert False commands.append(template.format(env_var=env_var, name=name)) - return "\n".join(commands) - def emit_commands(syntax): - commands = [] for index, command_tpl in enumerate(self.command_templates): command = render(command_tpl, origin="".format(index + 1), syntax=syntax) @@ -315,6 +311,7 @@ class TemplatedPlatform(Platform): commands.append(command + " || exit /b") else: assert False + return "\n".join(commands) def get_override(var): @@ -379,7 +376,6 @@ class TemplatedPlatform(Platform): "emit_rtlil": emit_rtlil, "emit_verilog": emit_verilog, "emit_debug_verilog": emit_debug_verilog, - "emit_prelude": emit_prelude, "emit_commands": emit_commands, "syntax": syntax, "invoke_tool": invoke_tool, -- 2.30.2