Skip to content

Commit

Permalink
Fix extra newlines in codegen output on Windows (#2054)
Browse files Browse the repository at this point in the history
By setting `"newline" => "\n"` in the OteraEngine Template config.

This means that the input, e.g. `schemas.py.jinja` will be assumed to
have LF line endings instead of the assumed CRLF line endings on
Windows. In our .gitattributes file, we have `*.py text eol=lf` which
means that the file will be checked out with LF line endings on Windows.

Fixes #2048
  • Loading branch information
visr authored Feb 13, 2025
1 parent a179579 commit 2474afd
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions utils/gen_python.jl
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,18 @@ function get_connectivity()
]
end

# Setup template with whitespace settings that mainly strips whitespace.
# See schemas.py.jinja for the layout of the template.
MODEL_TEMPLATE = Template(
normpath(@__DIR__, "templates", "schemas.py.jinja");
config = Dict("trim_blocks" => true, "lstrip_blocks" => true, "autoescape" => false),
config = Dict(
"trim_blocks" => true,
"lstrip_blocks" => true,
"autoescape" => false,
"newline" => "\n",
)

CONNECTION_TEMPLATE = Template(
normpath(@__DIR__, "templates", "validation.py.jinja");
config = Dict("trim_blocks" => true, "lstrip_blocks" => true, "autoescape" => false),
)
# Setup template with whitespace settings that mainly strips whitespace.
# See schemas.py.jinja for the layout of the template.
MODEL_TEMPLATE = Template(normpath(@__DIR__, "templates", "schemas.py.jinja"); config)
CONNECTION_TEMPLATE =
Template(normpath(@__DIR__, "templates", "validation.py.jinja"); config)

function (@main)(_)::Cint
# Write schemas.py
Expand Down

0 comments on commit 2474afd

Please sign in to comment.