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