bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] gnulib-tool.py: Fix output of gnulib-comp.m4.


From: Collin Funk
Subject: [PATCH] gnulib-tool.py: Fix output of gnulib-comp.m4.
Date: Sat, 2 Mar 2024 19:02:02 -0800
User-agent: Mozilla Thunderbird

When working on the one of the TODO entries I noticed that
the gnulib-comp.m4 output was incorrect. The indentation was slightly
off and the output also had "if True;" conditionals. Here is a diff
from Emacs merge-gnulib to show the difference:

@@ -784,8 +785,12 @@ AC_DEFUN
     if $gl_gnulib_enabled_8444034ea779b88768865bb60b4fb8c9; then :; else
       AC_PROG_MKDIR_P
       gl_gnulib_enabled_8444034ea779b88768865bb60b4fb8c9=true
-      func_gl_gnulib_m4code_ef455225c00f5049c808c2eda3e76866
-      func_gl_gnulib_m4code_61bcaca76b3e6f9ae55d57a1c3193bc4
+  if True; then
+    func_gl_gnulib_m4code_ef455225c00f5049c808c2eda3e76866
+  fi
+  if True; then
+    func_gl_gnulib_m4code_61bcaca76b3e6f9ae55d57a1c3193bc4
+  fi
     fi
   }

This seems to be caused by GLModuleTable.addConditional [1] allowing
string values or boolean True values. When outputting the
conditionals in GLEmiter.autoconfSnippets, the condition is printed as
long as the return value is not None [2]. Therefore, when True is
returned it is printed. The shell script does not print the
conditional in these cases.

I've opted to use "type(condition) is str" and not "condition != True"
to avoid any problems comparing a string to a bool. I doubt it would
cause problems, but the type check in addConditional would ensure it
isn't anything else weird.

[1] 
https://git.savannah.gnu.org/cgit/gnulib.git/tree/pygnulib/GLModuleSystem.py#n769
[2] https://git.savannah.gnu.org/cgit/gnulib.git/tree/pygnulib/GLEmiter.py#n181

Collin

Attachment: 0001-gnulib-tool.py-Fix-output-of-gnulib-comp.m4.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]