From: Bruno Haible <bruno@clisp.org>
To: bug-gnulib@gnu.org
Subject: gnulib-tool.py: Fix parsing of gnulib-cache.m4
Date: Fri, 12 Apr 2024 16:35:14 +0200 [thread overview]
Message-ID: <5927248.AAaOv8X9El@nimes> (raw)
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 <bruno@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',
reply other threads:[~2024-04-12 14:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5927248.AAaOv8X9El@nimes \
--to=bruno@clisp.org \
--cc=bug-gnulib@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).