I see this test failure: $ ./test-cache-2-19.sh Only in tmp1861851-result/lib: Makefile.am Only in ./test-cache-2-19.result/lib: Makefile.gnulib Files ./test-cache-2-19.result/m4/gnulib-cache.m4 and tmp1861851-result/m4/gnulib-cache.m4 differ Only in tmp1861851-result/tests: Makefile.am Only in ./test-cache-2-19.result/tests: Makefile.gnulib FAIL: gnulib-tool's result has unexpected differences. $ diff -u ./test-cache-2-19.result/m4/gnulib-cache.m4 tmp1861851-result/m4/gnulib-cache.m4 --- ./test-cache-2-19.result/m4/gnulib-cache.m4 2024-04-12 13:39:25.060862723 +0200 +++ tmp1861851-result/m4/gnulib-cache.m4 2024-04-12 16:00:15.271757098 +0200 @@ -44,7 +44,6 @@ # --with-unportable-tests \ # --with-all-tests \ # --lgpl \ -# --makefile-name=Makefile.gnulib \ # --automake-subdir \ # --no-conditional-dependencies \ # --libtool \ @@ -75,7 +74,7 @@ gl_WITH_TESTS gl_LIB([libgnu]) gl_LGPL -gl_MAKEFILE_NAME([Makefile.gnulib]) +gl_MAKEFILE_NAME([]) gl_AUTOMAKE_SUBDIR gl_LIBTOOL gl_MACRO_PREFIX([gl])
The cause is that at GLImport.py:167 the 'result' variable contains a pair ('gl_LGPL\ngl_MAKEFILE_NAME', 'Makefile.gnulib'). But only 'gl_LGPL' or 'gl_MAKEFILE_NAME' should be parsed as a key, not a string that contains a newline. This patch fixes it, 2024-04-12 Bruno Haible <br...@clisp.org> gnulib-tool.py: Fix parsing of gnulib-cache.m4. * pygnulib/GLImport.py (GLImport.__init__): While parsing gnulib-cache.m4, stop parsing the identifier starting with 'gl_' when encountering a character that is not a uppercase letter, digit, or underscore. diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py index 8a576c2fb1..38f17bb8b4 100644 --- a/pygnulib/GLImport.py +++ b/pygnulib/GLImport.py @@ -114,12 +114,12 @@ class GLImport: # Get other cached variables. path = joinpath(self.config['m4base'], 'gnulib-cache.m4') - if isfile(joinpath(self.config['m4base'], 'gnulib-cache.m4')): + if isfile(path): with codecs.open(path, 'rb', 'UTF-8') as file: data = file.read() # Create regex object and keys. - pattern = re.compile(r'^(gl_.*?)\((.*?)\)$', re.S | re.M) + pattern = re.compile(r'^(gl_[A-Z0-9_]*)\((.*?)\)$', re.S | re.M) keys = \ [ 'gl_LOCAL_DIR', 'gl_MODULES', 'gl_AVOID', 'gl_SOURCE_BASE',