+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.
--------------------------------------------------------------------------------
-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
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)