This patch explains the random tests/ directory that gnulib-tool.py
makes with the Emacs script. I've tried to make this patch match the
shell code. I was a bit confused by missing print statements in the
Python version's transitive_closure_separately but it seems that is
handled in GLImport.prepare() instead.
Also, I've noticed that some functions check if a type(var) == list.
To avoid problems I've returned an empty list instead of None. I've
used the Emacs script and it doesn't create the tests/ with a few
snippet headers anymore.
Collin
From 73eca650d24767b412f1c82d0fe0815c0d2e51fc Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Wed, 28 Feb 2024 19:05:16 -0800
Subject: [PATCH] gnulib-tool.py: Follow gnulib-tool changes, part 33.
Follow gnulib-tool change
2017-03-14 Bruno Haible <br...@clisp.org>
gnulib-tool: Don't produce a tests directory with only snippet .h files.
* pygnulib/GLModuleSystem.py
(GLModuleTable.transitive_closure_separately): Don't create a test
directory if all test related modules have applicability 'all'.
---
ChangeLog | 10 ++++++++++
gnulib-tool.py.TODO | 12 ------------
pygnulib/GLModuleSystem.py | 11 ++++++++++-
3 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 398d1d5cda..a77eb99cec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-02-28 Collin Funk <collin.fu...@gmail.com>
+
+ gnulib-tool.py: Follow gnulib-tool changes, part 33.
+ Follow gnulib-tool change
+ 2017-03-14 Bruno Haible <br...@clisp.org>
+ gnulib-tool: Don't produce a tests directory with only snippet .h files.
+ * pygnulib/GLModuleSystem.py
+ (GLModuleTable.transitive_closure_separately): Don't create a test
+ directory if all test related modules have applicability 'all'.
+
2024-02-28 Collin Funk <collin.fu...@gmail.com>
gnulib-tool.py: Follow gnulib-tool changes, part 32.
diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO
index 905793e0c7..42cccaf71e 100644
--- a/gnulib-tool.py.TODO
+++ b/gnulib-tool.py.TODO
@@ -830,18 +830,6 @@ Date: Mon May 15 23:13:57 2017 +0200
--------------------------------------------------------------------------------
-commit 363135016c25696d7a173094715e7f3f2dda3596
-Author: Bruno Haible <br...@clisp.org>
-Date: Wed Mar 15 23:24:03 2017 +0100
-
- gnulib-tool: Don't produce a tests directory with only snippet .h files.
-
- * gnulib-tool (func_modules_transitive_closure_separately): If
- testsrelated_modules ends up with no "real" modules, aside from
- modules with applicability 'all', set it to empty.
-
---------------------------------------------------------------------------------
-
commit f30205c5d59bab2c035165158e7d5d65b07b8363
Author: Mathieu Lirzin <m...@gnu.org>
Date: Tue Mar 14 12:19:40 2017 +0100
diff --git a/pygnulib/GLModuleSystem.py b/pygnulib/GLModuleSystem.py
index 787614d38c..675d33de32 100644
--- a/pygnulib/GLModuleSystem.py
+++ b/pygnulib/GLModuleSystem.py
@@ -989,7 +989,16 @@ class GLModuleTable(object):
# + [ m
# for m in main_modules
# if m.getApplicability() != 'main' ]
- tests_modules = sorted(set(tests_modules))
+ tests_modules = sorted(list(set(tests_modules)))
+ # If testsrelated_modules consists only of modules with applicability 'all',
+ # set it to empty (because such modules are only helper modules for other modules).
+ have_nontrivial_testsrelated_modules = False
+ for module in tests_modules:
+ if module.getApplicability() != 'all':
+ have_nontrivial_testsrelated_modules = True
+ break
+ if not have_nontrivial_testsrelated_modules:
+ tests_modules = []
result = tuple([main_modules, tests_modules])
return result
--
2.39.2