From: Collin Funk Date: Fri, 1 Mar 2024 02:37:53 +0000 (-0800) Subject: gnulib-tool.py: Fix GNU Make conversion regular expressions. X-Git-Tag: v1.0~353 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a67984f9c3f8b304dda8594e65cb6ea7e3db521c;p=thirdparty%2Fgnulib.git gnulib-tool.py: Fix GNU Make conversion regular expressions. * pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Reduce code duplication. Use re.MULTILINE so '^' matches the start of each line instead of only the start of a string. --- diff --git a/ChangeLog b/ChangeLog index 9536c174f8..39e65420fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2024-03-01 Collin Funk + + gnulib-tool.py: Fix GNU Make conversion regular expressions. + * pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Reduce code + duplication. Use re.MULTILINE so '^' matches the start of each line + instead of only the start of a string. + 2024-02-29 Collin Funk gnulib-tool.py: Follow gnulib-tool changes, part 36. diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py index dcabc3523c..9030a67fe3 100644 --- a/pygnulib/GLEmiter.py +++ b/pygnulib/GLEmiter.py @@ -640,6 +640,7 @@ AC_DEFUN([%V1%_LIBSOURCES], [ module_indicator_prefix = self.config.getModuleIndicatorPrefix() ac_version = self.config['ac_version'] destfile = os.path.normpath(destfile) + convert_to_gnu_make_1 = (re.compile(r'^if (.*)', re.MULTILINE), r'ifneq (,$(\1))') emit = '' # When using GNU make, or when creating an includable Makefile.am snippet, @@ -712,9 +713,6 @@ AC_DEFUN([%V1%_LIBSOURCES], [ allsnippets += '## begin gnulib module %s\n' % str(module) if gnu_make: allsnippets += 'ifeq (,$(OMIT_GNULIB_MODULE_%s))\n' % str(module) - convert_to_gnu_make = True - else: - convert_to_gnu_make = False allsnippets += '\n' if conddeps: if moduletable.isConditional(module): @@ -723,15 +721,15 @@ AC_DEFUN([%V1%_LIBSOURCES], [ allsnippets += 'ifneq (,$(%s))\n' % name else: allsnippets += 'if %s\n' % name - if convert_to_gnu_make: - allsnippets += re.sub(r'^if (.*)', r'ifneq (,$(\1))', amsnippet1) + if gnu_make: + allsnippets += re.sub(convert_to_gnu_make_1[0], convert_to_gnu_make_1[1], amsnippet1) else: allsnippets += amsnippet1 if conddeps: if moduletable.isConditional(module): allsnippets += 'endif\n' - if convert_to_gnu_make: - allsnippets += re.sub(r'^if (.*)', r'ifneq (,$(\1))', amsnippet2) + if gnu_make: + allsnippets += re.sub(convert_to_gnu_make_1[0], convert_to_gnu_make_1[1], amsnippet2) else: allsnippets += amsnippet2 if gnu_make: