[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnulib-tool.py: Make regular expression more strict.
From: |
Collin Funk |
Subject: |
gnulib-tool.py: Make regular expression more strict. |
Date: |
Tue, 2 Apr 2024 04:52:03 -0700 |
User-agent: |
Mozilla Thunderbird |
This regular expression should be much more strict. This patch should
fix it. The 'inttostr' module seems like the best way to show this:
diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py
index fac29883f9..1724b250da 100644
--- a/pygnulib/GLModuleSystem.py
+++ b/pygnulib/GLModuleSystem.py
@@ -1039,6 +1039,8 @@ class GLModuleTable(object):
pattern = re.compile(r'^lib_SOURCES[\t ]*\+=([^#]*).*$',
re.M)
for matching_rhs in pattern.findall(snippet):
files = matching_rhs.split(' ')
+ if module.name == 'inttostr':
+ print(files)
for file in files:
# Ignore .h files since they are not compiled.
if not file.endswith('.h'):
['', '', '', '', 'imaxtostr.c', '', '', '', 'inttostr.c', '', '', '',
'offtostr.c', '', '', '', 'uinttostr.c', '', '', '',
'umaxtostr.c\n\nEXTRA_DIST', '+=', 'anytostr.c',
'inttostr.h\n\nEXTRA_lib_SOURCES', '+=', 'anytostr.c\n\n']
After this patch:
['imaxtostr.c', 'inttostr.c', 'offtostr.c', 'uinttostr.c', 'umaxtostr.c']
Since we just called combine_lines, we should only have to match until
the end of the line starting with 'lib_SOURCES'. Assuming I am
interpreting this comment correctly:
# Extract the value of unconditional "lib_SOURCES += ..." augmentations.
and the sed invocation in gnulib-tool.sh line 3447:
sed -n -e 's,^lib_SOURCES[ ]*+=\([^#]*\).*$,\1,p'
Collin
0001-gnulib-tool.py-Make-regular-expression-more-strict.patch
Description: Text Data
- gnulib-tool.py: Make regular expression more strict.,
Collin Funk <=