From a903cf8e58c222def96f041c5c527ba6e905b9fa Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sun, 10 Mar 2024 00:43:20 -0800 Subject: [PATCH 3/5] gnulib-tool.py: Follow gnulib-tool changes, part 53. Follow gnulib-tool change 2021-12-21 Bruno Haible Optimize redundant 'mkdir -p .' invocations. * pygnulib/GLEmiter.py (_eliminate_NMD): New private function to eliminate occurrences of @NMD@ from Automake snippets. (GLEmiter.lib_Makefile_am, GLEmiter.tests_Makefile_am): Use it. --- ChangeLog | 10 ++++++ gnulib-tool.py.TODO | 81 -------------------------------------------- pygnulib/GLEmiter.py | 11 ++++++ 3 files changed, 21 insertions(+), 81 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8dda625922..27a9b2ea2c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2024-03-10 Collin Funk + + gnulib-tool.py: Follow gnulib-tool changes, part 53. + Follow gnulib-tool change + 2021-12-21 Bruno Haible + Optimize redundant 'mkdir -p .' invocations. + * pygnulib/GLEmiter.py (_eliminate_NMD): New private function to + eliminate occurrences of @NMD@ from Automake snippets. + (GLEmiter.lib_Makefile_am, GLEmiter.tests_Makefile_am): Use it. + 2024-03-09 Collin Funk gnulib-tool.py: Follow gnulib-tool changes, part 52. diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO index e6c94c8bb8..c3d5d65f5c 100644 --- a/gnulib-tool.py.TODO +++ b/gnulib-tool.py.TODO @@ -207,87 +207,6 @@ Date: Fri Dec 24 17:22:00 2021 -0800 -------------------------------------------------------------------------------- -commit 83a0d5891db50c00e283e70df694b6003b1f485d -Author: Bruno Haible -Date: Tue Dec 21 09:59:17 2021 +0100 - - Optimize redundant 'mkdir -p .' invocations. - - Reported by Paul Eggert. - - * gnulib-tool (func_emit_lib_Makefile_am, func_emit_tests_Makefile_am): - Eliminate @NMD@ tokens. - * modules/alloca-opt (Makefile.am): Prefix the "$(MKDIR_P) '%reldir%'" - line with @NMD@. - * modules/argz (Makefile.am): Likewise. - * modules/assert-h (Makefile.am): Likewise. - * modules/byteswap (Makefile.am): Likewise. - * modules/configmake (Makefile.am): Likewise. - * modules/ctype (Makefile.am): Likewise. - * modules/dirent (Makefile.am): Likewise. - * modules/errno (Makefile.am): Likewise. - * modules/execinfo (Makefile.am): Likewise. - * modules/fcntl-h (Makefile.am): Likewise. - * modules/float (Makefile.am): Likewise. - * modules/fnmatch-h (Makefile.am): Likewise. - * modules/getopt-posix (Makefile.am): Likewise. - * modules/glob-h (Makefile.am): Likewise. - * modules/iconv-h (Makefile.am): Likewise. - * modules/ieee754-h (Makefile.am): Likewise. - * modules/inttypes-incomplete (Makefile.am): Likewise. - * modules/langinfo (Makefile.am): Likewise. - * modules/libtextstyle-optional (Makefile.am): Likewise. - * modules/limits-h (Makefile.am): Likewise. - * modules/locale (Makefile.am): Likewise. - * modules/malloc-h (Makefile.am): Likewise. - * modules/math (Makefile.am): Likewise. - * modules/monetary (Makefile.am): Likewise. - * modules/netdb (Makefile.am): Likewise. - * modules/openmp-init (Makefile.am): Likewise. - * modules/poll-h (Makefile.am): Likewise. - * modules/posix-shell (Makefile.am): Likewise. - * modules/pthread-h (Makefile.am): Likewise. - * modules/pty (Makefile.am): Likewise. - * modules/sched (Makefile.am): Likewise. - * modules/search (Makefile.am): Likewise. - * modules/signal-h (Makefile.am): Likewise. - * modules/sigsegv (Makefile.am): Likewise. - * modules/snippet/link-warning (Makefile.am): Likewise. - * modules/spawn (Makefile.am): Likewise. - * modules/stdalign (Makefile.am): Likewise. - * modules/stdarg (Makefile.am): Likewise. - * modules/stdbool (Makefile.am): Likewise. - * modules/stddef (Makefile.am): Likewise. - * modules/stdint (Makefile.am): Likewise. - * modules/stdio (Makefile.am): Likewise. - * modules/stdlib (Makefile.am): Likewise. - * modules/stdnoreturn (Makefile.am): Likewise. - * modules/string (Makefile.am): Likewise. - * modules/strings (Makefile.am): Likewise. - * modules/sysexits (Makefile.am): Likewise. - * modules/termios (Makefile.am): Likewise. - * modules/threads-h (Makefile.am): Likewise. - * modules/time (Makefile.am): Likewise. - * modules/uchar (Makefile.am): Likewise. - * modules/unicase/base (Makefile.am): Likewise. - * modules/uniconv/base (Makefile.am): Likewise. - * modules/unictype/base (Makefile.am): Likewise. - * modules/unigbrk/base (Makefile.am): Likewise. - * modules/unilbrk/base (Makefile.am): Likewise. - * modules/uniname/base (Makefile.am): Likewise. - * modules/uninorm/base (Makefile.am): Likewise. - * modules/unistd (Makefile.am): Likewise. - * modules/unistdio/base (Makefile.am): Likewise. - * modules/unistr/base (Makefile.am): Likewise. - * modules/unitypes (Makefile.am): Likewise. - * modules/uniwbrk/base (Makefile.am): Likewise. - * modules/uniwidth/base (Makefile.am): Likewise. - * modules/utime-h (Makefile.am): Likewise. - * modules/wchar (Makefile.am): Likewise. - * modules/wctype-h (Makefile.am): Likewise. - --------------------------------------------------------------------------------- - commit 4bdc327dbda59dcdbfa0f983a4f35c4a4ec3578c Author: Bruno Haible Date: Sun Dec 19 12:49:16 2021 +0100 diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py index 9774a56378..0845bce5f1 100644 --- a/pygnulib/GLEmiter.py +++ b/pygnulib/GLEmiter.py @@ -65,6 +65,14 @@ def _convert_to_gnu_make(snippet: str) -> str: return snippet +def _eliminate_NMD(snippet: str, automake_subdir: bool) -> str: + if automake_subdir: + lines = [line if not line.startswith('@NMD@') else line.replace('@NMD@', '') for line in snippet.splitlines()] + else: + lines = [line for line in snippet.splitlines() if not line.startswith('@NMD@')] + return '\n'.join(lines) + '\n' + + #=============================================================================== # Define GLEmiter class #=============================================================================== @@ -682,6 +690,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [ auxdir = self.config['auxdir'] gnu_make = self.config['gnu_make'] makefile_name = self.config['makefile_name'] + automake_subdir = self.config['automake_subdir'] libtool = self.config['libtool'] macro_prefix = self.config['macro_prefix'] podomain = self.config['podomain'] @@ -735,6 +744,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [ if eliminate_LDFLAGS: pattern = re.compile('^(lib_LDFLAGS[\t ]*\\+=.*$\n)', re.M) amsnippet1 = pattern.sub('', amsnippet1) + amsnippet1 = _eliminate_NMD(amsnippet1, automake_subdir) pattern = re.compile('lib_([A-Z][A-Z]*)', re.M) amsnippet1 = pattern.sub('%s_%s_\\1' % (libname, libext), amsnippet1) @@ -1035,6 +1045,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [ if eliminate_LDFLAGS: pattern = re.compile('^(lib_LDFLAGS[\t ]*\\+=.*$\n)', re.M) amsnippet1 = pattern.sub('', amsnippet1) + amsnippet1 = _eliminate_NMD(amsnippet1, False) pattern = re.compile('lib_([A-Z][A-Z]*)', re.M) amsnippet1 = pattern.sub('libtests_a_\\1', amsnippet1) amsnippet1 = amsnippet1.replace('$(GNULIB_', '$(' + module_indicator_prefix + '_GNULIB_') -- 2.44.0