On 3/23/24 4:49 AM, Bruno Haible wrote:
> If the variable has 3 possible values (None, False, True), then writing
> 'if value == True:' is the simpler way. Why would one use a conversion to
> bool, i.e. 3-values to 2-values conversion? It would only make things
> more complicated.
Yes, I agree now. I think that I saw True / False and figured it
should just be treated as a bool. However, the way GLConfig is set up,
vc_files along with many other variables can also be None. Therefore,
that assumption is bad. I will be more careful about that in the
future...
Type hints in the future will help:
# This
vc_files: bool | None
# Not this
vc_files: bool
I've attached an updated patch.
Collin
From 25173b648f1c0d89cc678fae240dbdb60d67e1ff Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Sat, 23 Mar 2024 12:55:58 -0700
Subject: [PATCH] gnulib-tool.py: Don't print Python bools in gnulib-cache.m4
* pygnulib/GLImport.py (GLImport.gnulib_cache): Convert Python bools to
lowercase before printing.
---
ChangeLog | 6 ++++++
pygnulib/GLImport.py | 3 ++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index cbda2c57d0..cb6e41f2cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-03-23 Collin Funk <collin.fu...@gmail.com>
+
+ gnulib-tool.py: Don't print Python bools in gnulib-cache.m4
+ * pygnulib/GLImport.py (GLImport.gnulib_cache): Convert Python bools to
+ lowercase before printing.
+
2024-03-23 Bruno Haible <br...@clisp.org>
gnulib-tool.py: Don't unnecessarily run configure && make in testdirs.
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index 8a0021d8dc..85ec0a61db 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -601,7 +601,8 @@ class GLImport(object):
emit += 'gl_PO_DOMAIN([%s])\n' % podomain
emit += 'gl_WITNESS_C_MACRO([%s])\n' % witness_c_macro
if vc_files != None:
- emit += 'gl_VC_FILES([%s])\n' % vc_files
+ # Convert Python bools to shell (True -> true).
+ emit += 'gl_VC_FILES([%s])\n' % str(vc_files).lower()
return constants.nlconvert(emit)
def gnulib_comp(self, filetable, gentests):
--
2.44.0