bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] gnulib-tool.py: Prefer str.splitlines() over str.split('\n')


From: Bruno Haible
Subject: Re: [PATCH] gnulib-tool.py: Prefer str.splitlines() over str.split('\n').
Date: Wed, 20 Mar 2024 11:58:44 +0100

Hi Collin,

> This patch changes calls of .split('\n') on string objects to
> .splitlines(). ...
> This should help reduce the amount of unexpected newlines in the
> output of Makefiles and other generated files.

I don't think this patch is appropriate:

* splitlines() is documented to treat the '\v', '\f', LINE SEPARATOR, and
  PARAGRAPH SEPARATOR characters like '\n'. Which is adequate for a display
  engine, but not for a string processing engine. gnulib-tool, however, is
  the latter. It should *not* canonicalize all of '\v', '\f', LINE SEPARATOR,
  PARAGRAPH SEPARATOR into newline, but rather preserve each of these
  characters with their unique meaning.

* If an Automake snippet has a blank line, we want that blank line to be
  preserved in the generated Makefile.am, not eliminated.

* Now is not the right moment for this kind of changes. First, we need to
  deal with the remaining items from the TODO list, other than optimizations,
  and focus on making the test suite pass with GNULIB_TOOL_IMPL=py.
  Then, we can make optimizations and other refactorings, checking each
  commit against the test suite. (That's what the test suite is made for!)

Bruno






reply via email to

[Prev in Thread] Current Thread [Next in Thread]