This patch should be pretty easy to test with:
$ gnulib-tool --create-testdir --dir mytestdir libtextstyle-optional
comparing gnulib-tool.sh and gnulib-tool.py before and after the
patch.
Also, I am aware that the conditional that I changed in
GLTestDir.execute() can be simplified to:
# Determine final file list.
if not single_configure:
main_modules = modules
tests_modules = [ module
for module in modules
if module.repeatModuleInTests() ]
main_filelist, tests_filelist = \
moduletable.filelist_separately(main_modules, tests_modules)
filelist = sorted(set(main_filelist + tests_filelist))
But shell script requires the
'if $single_configure; then ... else ... fi' because the function
messes with variables.
I figured that simplifying it might just make it harder to cross
reference if someone new wants to mess with gnulib-tool.py. :)
Collin
From cab20e9eafaa717132c4c085a88cb86cf66a6efb Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Mon, 18 Mar 2024 16:26:34 -0700
Subject: [PATCH 2/2] gnulib-tool.py: Follow gnulib-tool changes, part 66.
Follow gnulib-tool change
2021-12-25 Bruno Haible <br...@clisp.org>
gnulib-tool: Fix handling of module libtextstyle-optional.
* pygnulib/GLModuleSystem.py (GLModule.repeatModuleInTests): New function.
* pygnulib/GLEmiter.py (GLEmiter.tests_Makefile_am): Use it for creating
the tests/Makefile.am.
* pygnulib/GLTestDir.py (GLTestDir.execute): Use it when creating the
file list.
---
ChangeLog | 12 ++++++++++++
gnulib-tool.py.TODO | 15 ---------------
pygnulib/GLEmiter.py | 5 ++++-
pygnulib/GLModuleSystem.py | 12 ++++++++++++
pygnulib/GLTestDir.py | 10 +++++++---
5 files changed, 35 insertions(+), 19 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index d24810a93c..20fd33b97a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2024-03-18 Collin Funk <collin.fu...@gmail.com>
+
+ gnulib-tool.py: Follow gnulib-tool changes, part 66.
+ Follow gnulib-tool change
+ 2021-12-25 Bruno Haible <br...@clisp.org>
+ gnulib-tool: Fix handling of module libtextstyle-optional.
+ * pygnulib/GLModuleSystem.py (GLModule.repeatModuleInTests): New function.
+ * pygnulib/GLEmiter.py (GLEmiter.tests_Makefile_am): Use it for creating
+ the tests/Makefile.am.
+ * pygnulib/GLTestDir.py (GLTestDir.execute): Use it when creating the
+ file list.
+
2024-03-18 Collin Funk <collin.fu...@gmail.com>
gnulib-tool.py: Follow gnulib-tool changes, part 65.
diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO
index ada248c59f..819cca07e6 100644
--- a/gnulib-tool.py.TODO
+++ b/gnulib-tool.py.TODO
@@ -73,21 +73,6 @@ Date: Tue Mar 1 10:01:22 2022 -0800
--------------------------------------------------------------------------------
-commit 9af17c55629c4cbe2facdc9edb5242136567ebba
-Author: Bruno Haible <br...@clisp.org>
-Date: Sat Dec 25 14:30:57 2021 +0100
-
- gnulib-tool: Fix handling of module libtextstyle-optional.
-
- Reported by Paul Eggert in
- <https://lists.gnu.org/archive/html/bug-gnulib/2021-12/msg00152.html>.
-
- * gnulib-tool (func_repeat_module_in_tests): New function.
- (func_emit_tests_Makefile_am, func_create_testdir): Use it for the file
- list and when creating tests/Makefile.am.
-
---------------------------------------------------------------------------------
-
commit 30459fe101541698ec704acb224946d73676750e
Author: Bruno Haible <br...@clisp.org>
Date: Thu Jun 8 15:09:31 2017 +0200
diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py
index f4db15481f..16984e7d99 100644
--- a/pygnulib/GLEmiter.py
+++ b/pygnulib/GLEmiter.py
@@ -1106,7 +1106,10 @@ AC_DEFUN([%V1%_LIBSOURCES], [
longrun_snippets = ''
for module in modules:
if for_test and not single_configure:
- accept = module.isTests()
+ if module.repeatModuleInTests():
+ accept = True
+ else:
+ accept = module.isTests()
else: # if for_test and not single_configure
accept = True
if accept:
diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py
index 4e4306fe37..a96a2988b5 100644
--- a/pygnulib/GLModuleSystem.py
+++ b/pygnulib/GLModuleSystem.py
@@ -331,6 +331,18 @@ class GLModule(object):
result = self.modulesystem.find(self.getTestsName())
return result
+ def repeatModuleInTests(self) -> bool:
+ '''Tests whether, when the tests have their own configure.ac script,
+ a given module should be repeated in the tests, although it was
+ already among the main modules.'''
+ # This module is special because it relies on a gl_LIBTEXTSTYLE_OPTIONAL
+ # invocation that it does not itself do or require. Therefore if the
+ # tests contain such an invocation, the module - as part of tests -
+ # will produce different AC_SUBSTed variable values than the same module
+ # - as part of the main configure.ac -.
+ result = self.getName() == 'libtextstyle-optional'
+ return result
+
def getDependenciesRecursively(self) -> str:
'''Return a list of recursive dependencies of this module separated
by a newline.'''
diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py
index e33319b575..6c3aeceb58 100644
--- a/pygnulib/GLTestDir.py
+++ b/pygnulib/GLTestDir.py
@@ -321,11 +321,15 @@ class GLTestDir(object):
if single_configure:
main_filelist, tests_filelist = \
moduletable.filelist_separately(main_modules, tests_modules)
- filelist = sorted(set(main_filelist + tests_filelist))
else: # if not single_configure
- filelist = moduletable.filelist(modules)
+ main_modules = modules
+ tests_modules = [ module
+ for module in modules
+ if module.repeatModuleInTests() ]
+ main_filelist, tests_filelist = \
+ moduletable.filelist_separately(main_modules, tests_modules)
- filelist = sorted(set(filelist))
+ filelist = sorted(set(main_filelist + tests_filelist))
# Print list of files.
if verbose >= 0:
--
2.44.0