]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Tweak last commit.
authorBruno Haible <bruno@clisp.org>
Mon, 11 Mar 2024 12:27:30 +0000 (13:27 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 11 Mar 2024 12:27:30 +0000 (13:27 +0100)
* pygnulib/GLEmiter.py (_eliminate_NMD): Don't add an extra newline when
the result should be empty.

ChangeLog
pygnulib/GLEmiter.py

index cf09ef2da41f5f12ea7c54d1fabfd94719ba2420..1210f53511b3b53dab61565c63b61ff3a0e5dfae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-03-11  Bruno Haible  <bruno@clisp.org>
+
+       gnulib-tool.py: Tweak last commit.
+       * pygnulib/GLEmiter.py (_eliminate_NMD): Don't add an extra newline when
+       the result should be empty.
+
 2024-03-11  Collin Funk  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Follow gnulib-tool changes, part 53.
index f0ae4627e6474846faf0cd22a7f3c8b6868ae3ee..11f1a2c9fc6aa9b729cfb7790e9b937187b02e5f 100644 (file)
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
+# Allow the use of union type specifiers, using the syntax Type1 | Type2,
+# in Python ≥ 3.7.  Cf. <https://docs.python.org/3/library/__future__.html>
+# and <https://stackoverflow.com/questions/73879925/>.
 from __future__ import annotations
+
 #===============================================================================
 # Define global imports
 #===============================================================================
@@ -84,7 +88,10 @@ def _eliminate_NMD(snippet: str, automake_subdir: bool) -> str:
         line = _eliminate_NMD_from_line(line, automake_subdir)
         if line != None:
             result.append(line)
-    return '\n'.join(result) + '\n'
+    if len(result) > 0:
+        return '\n'.join(result) + '\n'
+    else:
+        return ''
 
 
 #===============================================================================