]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Follow gnulib-tool changes, part 54.
authorCollin Funk <collin.funk1@gmail.com>
Mon, 11 Mar 2024 07:42:57 +0000 (00:42 -0700)
committerBruno Haible <bruno@clisp.org>
Mon, 11 Mar 2024 12:32:50 +0000 (13:32 +0100)
Follow gnulib-tool change
2021-12-24  Paul Eggert  <eggert@cs.ucla.edu>
maint: avoid empty lines in recipes

* pygnulib/GLEmiter.py (_eliminate_NMD_from_line): Eliminate occurrences
of @!NMD@ too. Document parameters in docstring.
(_eliminate_NMD): Update docstring to reflect changes. Document
parameters.

ChangeLog
gnulib-tool.py.TODO
pygnulib/GLEmiter.py

index 1210f53511b3b53dab61565c63b61ff3a0e5dfae..83979be9f477c7d6eb5654f51e728c02ed22ec23 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-03-11  Collin Funk  <collin.funk1@gmail.com>
+
+       gnulib-tool.py: Follow gnulib-tool changes, part 54.
+       Follow gnulib-tool change
+       2021-12-24  Paul Eggert  <eggert@cs.ucla.edu>
+       maint: avoid empty lines in recipes
+       * pygnulib/GLEmiter.py (_eliminate_NMD_from_line): Eliminate occurrences
+       of @!NMD@ too. Document parameters in docstring.
+       (_eliminate_NMD): Update docstring to reflect changes. Document
+       parameters.
+
 2024-03-11  Bruno Haible  <bruno@clisp.org>
 
        gnulib-tool.py: Tweak last commit.
index c3d5d65f5ce925a4dac7cad52e1b2938485456d3..69d3cf7d72299ce333dba97f5e2149652130f717 100644 (file)
@@ -169,44 +169,6 @@ Date:   Sat Dec 25 12:19:13 2021 +0100
 
 --------------------------------------------------------------------------------
 
-commit b4c57b4240992832fa89a02dc620c4fa5ac36973
-Author: Paul Eggert <eggert@cs.ucla.edu>
-Date:   Fri Dec 24 17:22:00 2021 -0800
-
-    maint: avoid empty lines in recipes
-
-    AIX 7.2 ‘make’ complains about recipe lines that are empty after
-    macro expansion, and I suppose there’s a good chance some
-    non-POSIX ‘make’ would prohibit them.  Rework macros so
-    that we can avoid them.
-    * gnulib-tool (func_emit_lib_Makefile_am)
-    (func_emit_lib_Makefile_am): Support @!NMD@ too.
-    * modules/gen-header (@gl_V_at): New macro.
-    * modules/alloca-opt, modules/argz, modules/assert-h:
-    * modules/byteswap, modules/configmake, modules/ctype:
-    * modules/dirent, modules/errno, modules/execinfo, modules/fcntl-h:
-    * modules/float, modules/fnmatch-h, modules/getopt-posix:
-    * modules/glob-h, modules/iconv-h, modules/ieee754-h:
-    * modules/inttypes-incomplete, modules/langinfo:
-    * modules/libtextstyle-optional, modules/limits-h, modules/locale:
-    * modules/malloc-h, modules/math, modules/monetary, modules/netdb:
-    * modules/openmp-init, modules/poll-h, modules/posix-shell:
-    * modules/pthread-h, modules/pty, modules/sched, modules/search:
-    * modules/signal-h, modules/sigsegv, modules/snippet/link-warning:
-    * modules/spawn, modules/stdalign, modules/stdarg, modules/stdbool:
-    * modules/stddef, modules/stdint, modules/stdio, modules/stdlib:
-    * modules/stdnoreturn, modules/string, modules/strings:
-    * modules/sysexits, modules/termios, modules/threads-h:
-    * modules/time, modules/uchar, modules/unicase/base:
-    * modules/uniconv/base, modules/unictype/base, modules/unigbrk/base:
-    * modules/unilbrk/base, modules/uniname/base, modules/uninorm/base:
-    * modules/unistd, modules/unistdio/base, modules/unistr/base:
-    * modules/unitypes, modules/uniwbrk/base, modules/uniwidth/base:
-    * modules/utime-h, modules/wchar, modules/wctype-h:
-    Use it.
-
---------------------------------------------------------------------------------
-
 commit 4bdc327dbda59dcdbfa0f983a4f35c4a4ec3578c
 Author: Bruno Haible <bruno@clisp.org>
 Date:   Sun Dec 19 12:49:16 2021 +0100
index 11f1a2c9fc6aa9b729cfb7790e9b937187b02e5f..bfb7d51c016ee51b4697f67068403a9af3924653 100644 (file)
@@ -71,18 +71,34 @@ def _convert_to_gnu_make(snippet: str) -> str:
 
 
 def _eliminate_NMD_from_line(line: str, automake_subdir: bool) -> str | None:
-    '''Eliminate occurrences of @NMD@ from the given line. The modified
-    line is returned or None if the line should be removed.'''
-    if line.startswith('@NMD@'):
-        if automake_subdir:
-            line = line.replace('@NMD@', '')
-        else:
-            line = None
+    '''Eliminate occurrences of @NMD@ and @!NMD@ from the given line. The
+    modified line is returned or None if the line should be removed.
+
+    line is the current line in the snippet being operated on.
+    automake_subdir is a bool that is True if --automake-subdir is in use,
+      else False.'''
+    if automake_subdir:
+        clean = '@NMD@'
+        eliminate = '@!NMD@'
+    else:
+        clean = '@!NMD@'
+        eliminate = '@NMD@'
+    # Check if we should eliminate the line from the output.
+    if line.startswith(eliminate):
+        return None
+    # Check if we should clean the mark but keep the line.
+    if line.startswith(clean):
+        return line.replace(clean, '')
     return line
 
 
 def _eliminate_NMD(snippet: str, automake_subdir: bool) -> str:
-    '''Return the Automake snippet with occurrences of @NMD@ removed.'''
+    '''Return the Automake snippet with occurrences of @NMD@ and @!NMD@
+    removed.
+
+    snippet is the Automake snippet being operated on.
+    automake_subdir is a bool that is True if --automake-subdir is in use,
+      else False.'''
     result = []
     for line in snippet.splitlines():
         line = _eliminate_NMD_from_line(line, automake_subdir)