diff options
author | Bruno Haible <bruno@clisp.org> | 2022-08-07 13:29:59 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2022-08-07 23:04:07 +0200 |
commit | 54bf87fe01941049356177a1902bdf1a3eb49f7f (patch) | |
tree | c0290602654a9d3416ead0b0e3d441a7f060cc78 /pygnulib/GLTestDir.py | |
parent | a68f103cc3863310e1c1b4dd9e05b7924381d9a1 (diff) | |
download | gnulib-54bf87fe01941049356177a1902bdf1a3eb49f7f.tar.gz |
gnulib-tool.py: Make regex uses more straightforward.
* pygnulib/GLModuleSystem.py: Don't use flag re.S on regular expressions
that are meant to match a single line only, and remove the use of the
"minimal matching" *? construct whose only purpose was to neutralize the
re.S flag.
* pygnulib/GLEmiter.py: Likewise.
* pygnulib/GLImport.py: Likewise.
* pygnulib/GLTestDir.py: Likewise.
Diffstat (limited to 'pygnulib/GLTestDir.py')
-rw-r--r-- | pygnulib/GLTestDir.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py index 757c494011..f8d9910ab7 100644 --- a/pygnulib/GLTestDir.py +++ b/pygnulib/GLTestDir.py @@ -299,7 +299,7 @@ class GLTestDir(object): notice = module.getNotice() if notice: print('Notice from module %s:' % str(module)) - pattern = re.compile('^(.*?)$', re.S | re.M) + pattern = re.compile('^(.*)$', re.M) notice = pattern.sub(' \\1', notice) print(notice) else: # if not single_configure @@ -307,7 +307,7 @@ class GLTestDir(object): notice = module.getNotice() if notice: print('Notice from module %s:' % str(module)) - pattern = re.compile('^(.*?)$', re.S | re.M) + pattern = re.compile('^(.*)$', re.M) notice = pattern.sub(' \\1', notice) print(notice) @@ -461,7 +461,7 @@ class GLTestDir(object): for line in snippet.split('\n') if line.strip() ] snippet = '\n'.join(lines) - pattern = re.compile('AC_REQUIRE\\(\\[([^()].*?)\\]\\)', re.S | re.M) + pattern = re.compile('AC_REQUIRE\\(\\[([^()].*)\\]\\)', re.M) snippet = pattern.sub('\\1', snippet) snippet = snippet.strip() snippets += [snippet] @@ -578,7 +578,7 @@ class GLTestDir(object): for line in snippet.split('\n') if line.strip() ] snippet = '\n'.join(lines) - pattern = re.compile('AC_REQUIRE\\(\\[([^()].*?)\\]\\)', re.S | re.M) + pattern = re.compile('AC_REQUIRE\\(\\[([^()].*)\\]\\)', re.M) snippet = pattern.sub('\\1', snippet) snippet = snippet.strip() snippets += [snippet] @@ -749,9 +749,9 @@ class GLTestDir(object): # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...". regex_find = list() - pattern = re.compile('^CLEANFILES[\t ]*\\+=(.*?)$', re.S | re.M) + pattern = re.compile('^CLEANFILES[\t ]*\\+=(.*)$', re.M) regex_find += pattern.findall(snippet) - pattern = re.compile('^MOSTLYCLEANFILES[\t ]*\\+=(.*?)$', re.S | re.M) + pattern = re.compile('^MOSTLYCLEANFILES[\t ]*\\+=(.*)$', re.M) regex_find += pattern.findall(snippet) regex_find = [ line.strip() for line in regex_find @@ -765,7 +765,7 @@ class GLTestDir(object): # Extract the value of "BUILT_SOURCES += ...". Remove variable references # such $(FOO_H) because they don't refer to distributed files. regex_find = list() - pattern = re.compile('^BUILT_SOURCES[\t ]*\\+=(.*?)$', re.S | re.M) + pattern = re.compile('^BUILT_SOURCES[\t ]*\\+=(.*)$', re.M) regex_find += pattern.findall(snippet) regex_find = [ line.strip() for line in regex_find @@ -791,9 +791,9 @@ class GLTestDir(object): # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...". regex_find = list() - pattern = re.compile('^CLEANFILES[\t ]*\\+=(.*?)$', re.S | re.M) + pattern = re.compile('^CLEANFILES[\t ]*\\+=(.*)$', re.M) regex_find += pattern.findall(snippet) - pattern = re.compile('^MOSTLYCLEANFILES[\t ]*\\+=(.*?)$', re.S | re.M) + pattern = re.compile('^MOSTLYCLEANFILES[\t ]*\\+=(.*)$', re.M) regex_find += pattern.findall(snippet) regex_find = [ line.strip() for line in regex_find @@ -808,7 +808,7 @@ class GLTestDir(object): # such $(FOO_H) because they don't refer to distributed files. regex_find = list() tests_built_sources = list() - pattern = re.compile('^BUILT_SOURCES[\t ]*\\+=(.*?)$', re.S | re.M) + pattern = re.compile('^BUILT_SOURCES[\t ]*\\+=(.*)$', re.M) regex_find += pattern.findall(snippet) regex_find = [ line.strip() for line in regex_find |