On 2022/08/21 22:16, Nathan Hartman wrote:

> This makes me wonder, though, how EZT [1] (the program that processes
> these templates) generates its output. Does it output the same line
> endings as found in the templates? Or does it unconditionally output
> "\n" endings when run on Unix and "\r\n" endings when run on Windows,
> regardless of the template's line endings? I haven't checked, but the
> answer to this question will strongly influence how the line endings
> of *.ezt files should be.

It depends on how we use EZT. EZT reads templates without changing
EOL style by read them in binary mode, and then write as str to
the stream 'fp' passed in generate() method by using fp.write().

The templates used only for Windows environments are:
    build_locale.ezt
    svn_config.vcproj.ezt
    svn_config.vcxproj.ezt
    svn_locale.vcproj.ezt
    svn_locale.vcxproj.ezt
    vcnet_sln.ezt
    vcnet_vcproj.ezt
    vcnet_vcxproj.ezt
    vcnet_vcxproj_filters.ezt
    vcnet_vsprops.ezt

Those are handled by gen_win.WinGeneratorBase and preserves EOL
style. It generates a content by passing StringIO() to
Template.generate() and then encode it as bytes, then write it
in binary mode.


The template used by gen_make.py are:
    build-outputs.mk.ezt
    pkg-config.in.ezt

Those files are written with text mode, opened with "w" mode and
default newline parameter (newline=None), so "\n" is  comverted
to "\r\n" if we run gen_make.py on Windows (but I not sure it
needs or not).

I think templates in tools/dist/templates are only for
tools/dist/release.py and it is assumed that it runs only on
Unix, so I didn't check them.

Cheers,
-- 
Yasuhito FUTATSUKI <futat...@yf.bsclub.org>

Reply via email to