+2024-04-11 Collin Funk <collin.funk1@gmail.com>
+
+ gnulib-tool.py: Remove redundant backslashes from regexps.
+ * pygnulib/GLTestDir.py (GLTestDir.execute): Don't backslash ']' when it
+ is outside of a set.
+ * pygnulib/GLImport.py (GLImport.__init__): Don't use a backslash when
+ ']' is at the start of a '[...]' set. Don't backslash special characters
+ in a '[...]' set since they have their meaning dropped.
+ * pygnulib/main.py (main): Likewise.
+
2024-04-11 Collin Funk <collin.funk1@gmail.com>
gnulib-tool.py: Simplify regular expressions.
self.cache.setAuxDir('.')
with codecs.open(self.config.getAutoconfFile(), 'rb', 'UTF-8') as file:
data = file.read()
- pattern = re.compile(r'^AC_CONFIG_AUX_DIR\([\[ ]*([^\]"\$`\\\)]+).*?$', re.MULTILINE)
+ pattern = re.compile(r'^AC_CONFIG_AUX_DIR\([\[ ]*([^]"$`\\)]+).*?$', re.MULTILINE)
match = pattern.search(data)
if match:
self.cache.setAuxDir(match.group(1))
if self.config['destdir']:
with open(self.config['configure_ac'], encoding='utf-8') as file:
data = file.read()
- pattern = re.compile(r'^.*AM_INIT_AUTOMAKE\([\[ ]*([^\]\)]*).*$', re.MULTILINE)
+ pattern = re.compile(r'^.*AM_INIT_AUTOMAKE\([\[ ]*([^])]*).*$', re.MULTILINE)
configure_ac_automake_options = pattern.findall(data)
if configure_ac_automake_options:
automake_options = { x
for line in snippet.split('\n')
if line.strip() ]
snippet = lines_to_multiline(lines)
- pattern = re.compile(r'AC_REQUIRE\(\[([^()]*)\]\)', re.M)
+ pattern = re.compile(r'AC_REQUIRE\(\[([^()]*)]\)', re.M)
snippet = pattern.sub(r'\1', snippet)
snippet = snippet.strip()
snippets.append(snippet)
for line in snippet.split('\n')
if line.strip() ]
snippet = lines_to_multiline(lines)
- pattern = re.compile(r'AC_REQUIRE\(\[([^()]*)\]\)', re.M)
+ pattern = re.compile(r'AC_REQUIRE\(\[([^()]*)]\)', re.M)
snippet = pattern.sub(r'\1', snippet)
snippet = snippet.strip()
snippets.append(snippet)
configure_ac_data = file.read()
guessed_m4dirs = []
- pattern = re.compile(r'^.*AC_CONFIG_MACRO_DIRS?\([\[ ]*([^\]"\$`\\\)]*).*$', re.MULTILINE)
+ pattern = re.compile(r'^.*AC_CONFIG_MACRO_DIRS?\([\[ ]*([^]"$`\\)]*).*$', re.MULTILINE)
match = pattern.findall(configure_ac_data)
# Append the match to guessed_m4dirs.
if match:
# No Makefile.am! Oh well. Look at the last generated aclocal.m4.
filepath = joinpath(destdir, 'aclocal.m4')
if isfile(filepath):
- pattern = re.compile(r'm4_include\(\[(.*?)\]\)')
+ pattern = re.compile(r'm4_include\(\[(.*?)]\)')
with codecs.open(filepath, 'rb', 'UTF-8') as file:
m4dirs = pattern.findall(file.read())
m4dirs = [ os.path.dirname(m4dir)