]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Fix GNU Make conversion regular expressions.
authorCollin Funk <collin.funk1@gmail.com>
Fri, 1 Mar 2024 02:37:53 +0000 (18:37 -0800)
committerBruno Haible <bruno@clisp.org>
Fri, 1 Mar 2024 11:57:39 +0000 (12:57 +0100)
* 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.

ChangeLog
pygnulib/GLEmiter.py

index 9536c174f83ce6c1e17cdcf292f50d1a223a2ae4..39e65420fc4ed17b83f160e151e8e3b22919fd95 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-03-01  Collin Funk  <collin.funk1@gmail.com>
+
+       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  <collin.funk1@gmail.com>
 
        gnulib-tool.py: Follow gnulib-tool changes, part 36.
index dcabc3523c2cab323920c9e6c5f22497492bc961..9030a67fe311bbc8b466b9dc3d7bfa80438ee0c9 100644 (file)
@@ -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: