Here is two patches. The first fixes on item in gnulib-tool.py.TODO. I
thought I remembered seeing a good test case for this on the mailing
list but the archives seem to be down at the moment.
The second fixes this diff in gnulib-cache.m4 I found when testing:
diff --git a/test-python/m4/gnulib-cache.m4 b/test-shell/m4/gnulib-cache.m4
index 6afe7d8d1c..91f3e48123 100644
--- a/test-python/m4/gnulib-cache.m4
+++ b/test-shell/m4/gnulib-cache.m4
@@ -27,7 +27,7 @@
# Specification in the form of a command-line invocation:
-# # gnulib-tool --import \
+# gnulib-tool --import \
# --lib=libgnu \
# --source-base=lib \
# --m4-base=m4 \
The actioncmd already handles the comment '#' so we don't need another
when outputting in gnulib_cache.
Collin
From ec722d1deb398d4f0f2ce526db5444543dd4bad4 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Tue, 5 Mar 2024 20:32:29 -0800
Subject: [PATCH 1/2] gnulib-tool.py: Follow gnulib-tool changes, part 42.
Follow gnulib-tool change
2019-02-15 Bruno Haible <br...@clisp.org>
gnulib-tool: Support --import with just a few tests, not --with-tests.
* pygnulib/GLImport.py (GLImport.execute): Use 'gentests' instead of
'inctests' when generating files.
* pygnulib/GLMakefileTable.py (GLMakefileTable.parent): Add 'gentests'
argument and use it instead of 'inctests'.
---
ChangeLog | 11 +++++++++++
gnulib-tool.py.TODO | 12 ------------
pygnulib/GLImport.py | 15 +++++++++++----
pygnulib/GLMakefileTable.py | 11 +++++++----
4 files changed, 29 insertions(+), 20 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0d11697d3d..11af768bea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2024-03-05 Collin Funk <collin.fu...@gmail.com>
+
+ gnulib-tool.py: Follow gnulib-tool changes, part 42.
+ Follow gnulib-tool change
+ 2019-02-15 Bruno Haible <br...@clisp.org>
+ gnulib-tool: Support --import with just a few tests, not --with-tests.
+ * pygnulib/GLImport.py (GLImport.execute): Use 'gentests' instead of
+ 'inctests' when generating files.
+ * pygnulib/GLMakefileTable.py (GLMakefileTable.parent): Add 'gentests'
+ argument and use it instead of 'inctests'.
+
2024-03-05 Collin Funk <collin.fu...@gmail.com>
gnulib-tool.py: Follow gnulib-tool changes, part 41.
diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO
index 2d8719a751..42728ed60d 100644
--- a/gnulib-tool.py.TODO
+++ b/gnulib-tool.py.TODO
@@ -619,18 +619,6 @@ Date: Mon Nov 18 13:32:46 2019 +0100
--------------------------------------------------------------------------------
-commit dc135c4fd14cdc219d316c61f344e64090cb33fd
-Author: Bruno Haible <br...@clisp.org>
-Date: Fri Feb 15 21:27:44 2019 +0100
-
- gnulib-tool: Support --import with just a few tests, not --with-tests.
-
- * gnulib-tool (func_import): New variable 'gentests'. Use it instead of
- 'inctests' when generating files; use 'inctests' only for computing the
- transitive closure.
-
---------------------------------------------------------------------------------
-
commit 425ee42259b04956aae20afc5204775ae6e79744
Author: Bruno Haible <br...@clisp.org>
Date: Wed Jan 23 05:11:54 2019 +0100
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index 3075dc3e47..ab10d96509 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -983,6 +983,12 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
verbose = self.config['verbosity']
actioncmd = self.actioncmd()
+ # Determine whether to put anything into $testsbase.
+ testsfiles = [ file
+ for file in filetable['all']
+ if file.startswith('tests/') or file.startswith('tests=lib/') ]
+ gentests = len(testsfiles) > 0
+
# Create all necessary directories.
dirs = list()
if pobase:
@@ -991,6 +997,8 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
for file in filetable['all']
if file.startswith('doc/') ]:
dirs += [docbase]
+ if gentests:
+ dirs += [testsbase]
dirs += [sourcebase, m4base, auxdir]
dirs += [ os.path.dirname(pair[0])
for pair in filetable['new'] ]
@@ -1095,7 +1103,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
testsbase_base = os.path.basename(testsbase)
self.makefiletable.editor(testsbase_dir, 'SUBDIRS', testsbase_base, True)
self.makefiletable.editor('', 'ACLOCAL_AMFLAGS', '-I %s' % m4base)
- self.makefiletable.parent()
+ self.makefiletable.parent(gentests)
# Create library makefile.
basename = joinpath(sourcebase, makefile_am)
@@ -1275,8 +1283,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
os.remove(tmpfile)
# Create tests Makefile.
- inctests = self.config.checkInclTestCategory(TESTS['tests'])
- if inctests:
+ if gentests:
basename = joinpath(testsbase, makefile_am)
tmpfile = self.assistant.tmpfilename(basename)
emit, uses_subdirs = self.emitter.tests_Makefile_am(basename,
@@ -1386,7 +1393,7 @@ in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library.''')
print(' - "include %s" from within "%s/Makefile.am",' % (makefile_name, sourcebase))
if pobase:
print(' - add "%s/Makefile.in to AC_CONFIG_FILES in %s,' % (pobase, configure_ac))
- if inctests:
+ if gentests:
if makefile_am == 'Makefile.am':
print(' - add "%s/Makefile" to AC_CONFIG_FILES in %s,' % (testsbase, configure_ac))
else: # if makefile_am != 'Makefile.am'
diff --git a/pygnulib/GLMakefileTable.py b/pygnulib/GLMakefileTable.py
index a63c2d6899..d1e6178880 100644
--- a/pygnulib/GLMakefileTable.py
+++ b/pygnulib/GLMakefileTable.py
@@ -80,13 +80,16 @@ class GLMakefileTable(object):
dictionary = {'dir': dir, 'var': var, 'val': val, 'dotfirst': dotfirst}
self.table += [dictionary]
- def parent(self):
- '''GLMakefileTable.parent()
+ def parent(self, gentests):
+ '''GLMakefileTable.parent(gentests)
Add a special row to Makefile.am table with the first parent directory
which contains or will contain Makefile.am file.
GLConfig: sourcebase, m4base, testsbase, incl_test_categories,
- excl_test_categories, makefile_name.'''
+ excl_test_categories, makefile_name.
+ gentests is a bool that is True if files are placed in $testsbase.'''
+ if type(gentests) is not bool:
+ raise TypeError('gentests must be a bool, not %s' % (type(gentests).__name__))
m4base = self.config['m4base']
sourcebase = self.config['sourcebase']
testsbase = self.config['testsbase']
@@ -102,7 +105,7 @@ class GLMakefileTable(object):
while (dir1
and (joinpath(self.config['destdir'], dir1, mfd)
or joinpath(dir1, mfd) == joinpath(sourcebase, mfx)
- or (inctests and joinpath(dir1, mfd) == joinpath(testsbase, mfx)))):
+ or (gentests and joinpath(dir1, mfd) == joinpath(testsbase, mfx)))):
dir2 = joinpath(os.path.basename(dir1), dir2)
dir1 = os.path.dirname(dir1)
self.editor(dir1, 'EXTRA_DIST', joinpath(dir2, 'gnulib-cache.m4'))
--
2.44.0
From f5f4f3944646e384bd47e3b2d06500de614ef789 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Tue, 5 Mar 2024 20:44:17 -0800
Subject: [PATCH 2/2] gnulib-tool.py: Fix gnulib-cache.m4 output.
* pygnulib/GLImport.py (GLImport.gnulib_cache): Don't emit an extra '#'
to start the actioncmd comment.
---
ChangeLog | 6 ++++++
pygnulib/GLImport.py | 2 +-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
index 11af768bea..cfba30ce3e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-03-05 Collin Funk <collin.fu...@gmail.com>
+
+ gnulib-tool.py: Fix gnulib-cache.m4 output.
+ * pygnulib/GLImport.py (GLImport.gnulib_cache): Don't emit an extra '#'
+ to start the actioncmd comment.
+
2024-03-05 Collin Funk <collin.fu...@gmail.com>
gnulib-tool.py: Follow gnulib-tool changes, part 42.
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index ab10d96509..a3623a9da1 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -509,7 +509,7 @@ class GLImport(object):
# Specification in the form of a command-line invocation:
-# %s
+%s
# Specification in the form of a few gnulib-tool.m4 macro invocations:\n''' % actioncmd
# Store the localpath relative to destdir.
--
2.44.0