Skip to content

Deduplicate Makefile writer and Jinja parameter filter - #546

Open
ThVerg wants to merge 1 commit into
olofk:mainfrom
ThVerg:refactor/dedupe-makewriter-jinja
Open

Deduplicate Makefile writer and Jinja parameter filter#546
ThVerg wants to merge 1 commit into
olofk:mainfrom
ThVerg:refactor/dedupe-makewriter-jinja

Conversation

@ThVerg

@ThVerg ThVerg commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Two pieces of logic exist twice in the codebase, byte for byte:

  • The Makefile writer: EdaCommands.write() in edalize/utils.py (used by legacy backends like yosys/trellis/apicula) and Make.write() in edalize/build_runners/make.py (used by the flow API). A fix applied to one silently misses the other. Make.write() now delegates to EdaCommands.write().
  • jinja_filter_param_value_str: defined identically in edalize/edatool.py and edalize/tools/edatool.py. The single definition now lives in edalize/utils.py (which has no imports, so no circular-import risk) and both base classes import it.

No functional change — the golden-file tests confirm the generated Makefiles are byte-identical (204 passed). Formatted with black 22.3.0.

The Makefile-writing logic existed twice, byte for byte: in
EdaCommands.write (used by legacy backends) and in the make build
runner (used by the flow API). A fix in one could not reach the
other. Make.write now delegates to EdaCommands.write.

jinja_filter_param_value_str was likewise defined identically in
edalize/edatool.py and edalize/tools/edatool.py. Move the single
definition to edalize/utils.py and import it from both.

No functional change; golden-file tests confirm generated output
is identical.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant