Skip to content

Commit

Permalink
Keep trailing newlines in templates
Browse files Browse the repository at this point in the history
Trailing newlines are good practice, but Jinja2 removes them from files
generated from templates by default. Set the right option to keep those
trailing newlines, and update the test files accordingly.

The Icestorm Makefile had two empty lines at the end, removed one.
  • Loading branch information
imphil authored and olofk committed May 8, 2019
1 parent 0a07c95 commit 710ee27
Show file tree
Hide file tree
Showing 19 changed files with 18 additions and 18 deletions.
1 change: 1 addition & 0 deletions edalize/edatool.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def __init__(self, edam=None, work_root=None, eda_api=None):
loader = PackageLoader(__package__, 'templates'),
trim_blocks = True,
lstrip_blocks = True,
keep_trailing_newline = True,
)
self.jinja_env.filters['param_value_str'] = jinja_filter_param_value_str
self.jinja_env.filters['generic_value_str'] = jinja_filter_param_value_str
Expand Down
1 change: 0 additions & 1 deletion edalize/templates/icestorm/icestorm-makefile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ build-gui: $(TARGET).json

clean:
rm -f $(TARGET).blif $(TARGET).json $(TARGET)_arachne.asc $(TARGET)_next.asc $(TARGET).bin

2 changes: 1 addition & 1 deletion tests/test_ascentlint/defaults/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ report-violations: ascentlint.log
@(egrep -q "(Found [0-9]+ info lint violations|No lint violations found)" \
ascentlint.log && echo "***PASSED***") || \
(echo "***ERROR*** Lint run found new errors or warnings." \
"Please check ascentlint.rpt" && exit 1)
"Please check ascentlint.rpt" && exit 1)
2 changes: 1 addition & 1 deletion tests/test_ascentlint/defaults/run-ascentlint.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ source tcl_file.tcl
analyze -f sources.f
elaborate -params { { vlogparam_bool 1 } { vlogparam_int 42 } { vlogparam_str "hello" } } top_module
report_policy -skip_empty_summary_status -compat -output ascentlint.rpt NEW
exit
exit
2 changes: 1 addition & 1 deletion tests/test_quartus/Pro/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ sta: asm
quartus_sta $(OPTIONS) $(NAME)

clean:
rm -rf *.* qdb tmp-clearbox
rm -rf *.* qdb tmp-clearbox
2 changes: 1 addition & 1 deletion tests/test_quartus/Standard/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ sta: asm
quartus_sta $(OPTIONS) $(NAME)

clean:
rm -rf *.* db incremental_db
rm -rf *.* db incremental_db
2 changes: 1 addition & 1 deletion tests/test_spyglass/defaults/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ run-goal-lint_lint_rtl:
sg_shell -enable_pass_exit_codes -tcl spyglass-run-lint_lint_rtl.tcl

run-gui:
spyglass -project $(NAME).prj
spyglass -project $(NAME).prj
2 changes: 1 addition & 1 deletion tests/test_spyglass/defaults/spyglass-run-design_read.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ if { $errorCode } {

# requires sg_shell to be called with -enable_pass_exit_codes, otherwise
# all non-fatal exit codes are mapped to 0
exit $errorCode
exit $errorCode
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ if { $errorCode } {

# requires sg_shell to be called with -enable_pass_exit_codes, otherwise
# all non-fatal exit codes are mapped to 0
exit $errorCode
exit $errorCode
2 changes: 1 addition & 1 deletion tests/test_spyglass/tooloptions/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ run-goal-some_othergoal:
sg_shell -enable_pass_exit_codes -tcl spyglass-run-some_othergoal.tcl

run-gui:
spyglass -project $(NAME).prj
spyglass -project $(NAME).prj
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ if { $errorCode } {

# requires sg_shell to be called with -enable_pass_exit_codes, otherwise
# all non-fatal exit codes are mapped to 0
exit $errorCode
exit $errorCode
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ if { $errorCode } {

# requires sg_shell to be called with -enable_pass_exit_codes, otherwise
# all non-fatal exit codes are mapped to 0
exit $errorCode
exit $errorCode
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ if { $errorCode } {

# requires sg_shell to be called with -enable_pass_exit_codes, otherwise
# all non-fatal exit codes are mapped to 0
exit $errorCode
exit $errorCode
2 changes: 1 addition & 1 deletion tests/test_vcs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ test_vcs_0: test_vcs_0.scr
run: test_vcs_0
./test_vcs_0 -l vcs.log +plusarg_bool=1 +plusarg_int=42 +plusarg_str=hello
clean:
$(RM) test_vcs_0
$(RM) test_vcs_0
2 changes: 1 addition & 1 deletion tests/test_vcs/minimal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ test_vcs_minimal_0: test_vcs_minimal_0.scr
run: test_vcs_minimal_0
./test_vcs_minimal_0 -l vcs.log
clean:
$(RM) test_vcs_minimal_0
$(RM) test_vcs_minimal_0
2 changes: 1 addition & 1 deletion tests/test_vivado/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ $(NAME).xpr: $(NAME).tcl
vivado -mode batch -source $<

build-gui: $(NAME).xpr
vivado $<
vivado $<
2 changes: 1 addition & 1 deletion tests/test_vivado/minimal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ $(NAME).xpr: $(NAME).tcl
vivado -mode batch -source $<

build-gui: $(NAME).xpr
vivado $<
vivado $<
2 changes: 1 addition & 1 deletion tests/test_vivado/minimal/test_vivado_minimal_0_run.tcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
launch_runs impl_1
wait_on_run impl_1
open_run impl_1
write_bitstream [current_project].bit
write_bitstream [current_project].bit
2 changes: 1 addition & 1 deletion tests/test_vivado/test_vivado_0_run.tcl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
launch_runs impl_1
wait_on_run impl_1
open_run impl_1
write_bitstream [current_project].bit
write_bitstream [current_project].bit

0 comments on commit 710ee27

Please sign in to comment.