Hi Bruno,
On 3/5/24 3:08 PM, Bruno Haible wrote:
> Oops, these comments of mine apply to part 41, not part 40!
No worries. I should have numbered the patches 0001, 0002, 0003 to
make your life easier. :)
>> Thanks, but there's a difference here:
>> In gnulib-tool the condition was
>>
>> if test "${var}" = SUBDIRS && test -n "$dotfirst"; then
>>
>> whereas in your patch, in pygnulib/GLEmiter.py lines 804 and 1108, I see
>>
>> if dictionary['dotfirst']:
>>
>> Where has the condition
>>
>> test "${var}" = SUBDIRS
>>
>> gone?
Good catch. My excuse will be that I was busy making sure I didn't mix
up 'var' and 'val'...
I've attached a patch that uses the condition:
if dictionary['var'] == 'SUBDIRS' and dictionary['dotfirst']:
which should match the original commit.
Collin
From c7257b6ae39c23425db09fff5a6dcf0fae45de01 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Tue, 5 Mar 2024 16:30:20 -0800
Subject: [PATCH] gnulib-tool.py: Follow gnulib-tool changes, part 41.
Follow gnulib-tool change
2018-09-03 Bruno Haible <br...@clisp.org>
gnulib-tool: Fix build order when $testsbase is a subdir of $sourcebase.
* pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Consider the dotfirst
flag.
(GLEmiter.tests_Makefile_am): Don't consider the dotfirst flag.
* pygnulib/GLImport.py (GLImport.execute): Set the dotfirst for tests.
* pygnulib/GLMakefileTable.py (GLMakefileTable.editor): Add optional
dotfirst flag to fix build order when $testsbase is a subdir of
$sourcebase.
---
ChangeLog | 14 ++++++++++++++
gnulib-tool.py.TODO | 15 ---------------
pygnulib/GLEmiter.py | 14 ++++++++++++--
pygnulib/GLImport.py | 2 +-
pygnulib/GLMakefileTable.py | 13 +++++++++----
5 files changed, 36 insertions(+), 22 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 33feae3fe5..0d11697d3d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2024-03-05 Collin Funk <collin.fu...@gmail.com>
+
+ gnulib-tool.py: Follow gnulib-tool changes, part 41.
+ Follow gnulib-tool change
+ 2018-09-03 Bruno Haible <br...@clisp.org>
+ gnulib-tool: Fix build order when $testsbase is a subdir of $sourcebase.
+ * pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Consider the dotfirst
+ flag.
+ (GLEmiter.tests_Makefile_am): Don't consider the dotfirst flag.
+ * pygnulib/GLImport.py (GLImport.execute): Set the dotfirst for tests.
+ * pygnulib/GLMakefileTable.py (GLMakefileTable.editor): Add optional
+ dotfirst flag to fix build order when $testsbase is a subdir of
+ $sourcebase.
+
2024-03-05 Collin Funk <collin.fu...@gmail.com>
gnulib-tool.py: Follow gnulib-tool changes, part 40.
diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO
index 72cf630b54..2d8719a751 100644
--- a/gnulib-tool.py.TODO
+++ b/gnulib-tool.py.TODO
@@ -660,21 +660,6 @@ Date: Fri Jan 4 19:34:19 2019 +0100
--------------------------------------------------------------------------------
-commit 8b1d4a63e34f3893036d82f39c5680e845de5ddf
-Author: Bruno Haible <br...@clisp.org>
-Date: Mon Sep 3 21:19:16 2018 +0200
-
- gnulib-tool: Fix build order when $testsbase is a subdir of $sourcebase.
-
- Reported by Antoine Luong <antoine.lu...@c-s.fr> in
- <https://lists.gnu.org/archive/html/bug-gnulib/2018-09/msg00008.html>.
-
- * gnulib-tool (func_import): For the tests, set a dotfirst flag.
- (func_emit_lib_Makefile_am): Consider the dotfirst flag.
- (func_emit_tests_Makefile_am): Don't consider the dotfirst flag.
-
---------------------------------------------------------------------------------
-
commit cd58dba367a3b8ffbebb23f2099a820106197fae
Author: Bruno Haible <br...@clisp.org>
Date: Sun Oct 29 16:57:32 2017 +0100
diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py
index 66833c4e98..ee963e69d7 100644
--- a/pygnulib/GLEmiter.py
+++ b/pygnulib/GLEmiter.py
@@ -800,7 +800,12 @@ AC_DEFUN([%V1%_LIBSOURCES], [
dictionary = makefiletable[current_edit]
if dictionary['var']:
if destfile == joinpath(dictionary['dir'], 'Makefile.am'):
- emit += '%s += %s\n' % (dictionary['var'], dictionary['val'])
+ val = dictionary['val']
+ if dictionary['var'] == 'SUBDIRS' and dictionary['dotfirst']:
+ # The added subdirectory ${val} needs to be mentioned after '.'.
+ # Since we don't have '.' among SUBDIRS so far, add it now.
+ val = f'. {val}'
+ emit += '%s += %s\n' % (dictionary['var'], val)
dictionary.pop('var')
# Define two parts of cppflags variable.
@@ -1099,7 +1104,12 @@ AC_DEFUN([%V1%_LIBSOURCES], [
dictionary = makefiletable[current_edit]
if dictionary['var']:
if destfile == joinpath(dictionary['dir'], 'Makefile.am'):
- emit += '%s += %s\n' % (dictionary['var'], dictionary['val'])
+ val = dictionary['val']
+ if dictionary['var'] == 'SUBDIRS' and dictionary['dotfirst']:
+ # The added subdirectory ${val} needs to be mentioned after '.'.
+ # But we have '.' among SUBDIRS already, so do nothing.
+ pass
+ emit += '%s += %s\n' % (dictionary['var'], val)
dictionary.pop('var')
emit += '\nAM_CPPFLAGS = \\\n'
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index 2f6e06a8bb..3075dc3e47 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -1093,7 +1093,7 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
if makefile_am == 'Makefile.am':
testsbase_dir = os.path.dirname(testsbase)
testsbase_base = os.path.basename(testsbase)
- self.makefiletable.editor(testsbase_dir, 'SUBDIRS', testsbase_base)
+ self.makefiletable.editor(testsbase_dir, 'SUBDIRS', testsbase_base, True)
self.makefiletable.editor('', 'ACLOCAL_AMFLAGS', '-I %s' % m4base)
self.makefiletable.parent()
diff --git a/pygnulib/GLMakefileTable.py b/pygnulib/GLMakefileTable.py
index 9f6fa548e1..a63c2d6899 100644
--- a/pygnulib/GLMakefileTable.py
+++ b/pygnulib/GLMakefileTable.py
@@ -61,18 +61,23 @@ class GLMakefileTable(object):
result = self.table[y]
return dict(result)
- def editor(self, dir, var, val):
- '''GLMakefileTable.editor(dir, var, val)
+ def editor(self, dir, var, val, dotfirst=False):
+ '''GLMakefileTable.editor(dir, var, val, dotfirst)
This method is used to remember that ${dir}Makefile.am needs to be edited
- to that ${var} mentions ${val}.'''
+ to that ${var} mentions ${val}.
+ If ${dotfirst} is non-empty, this mention needs to be present after '.'.
+ This is a special hack for the SUBDIRS variable, cf.
+ <https://www.gnu.org/software/automake/manual/html_node/Subdirectories.html>.'''
if type(dir) is not str:
raise TypeError('dir must be a string, not %s' % (type(dir).__name__))
if type(var) is not str:
raise TypeError('var must be a string, not %s' % (type(var).__name__))
if type(val) is not str:
raise TypeError('val must be a string, not %s' % (type(val).__name__))
- dictionary = {'dir': dir, 'var': var, 'val': val}
+ if type(dotfirst) is not bool:
+ raise TypeError('dotfirst must be a bool, not %s' % (type(dotfirst).__name__))
+ dictionary = {'dir': dir, 'var': var, 'val': val, 'dotfirst': dotfirst}
self.table += [dictionary]
def parent(self):
--
2.44.0