]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool.py: Follow gnulib-tool changes, part 41.
authorCollin Funk <collin.funk1@gmail.com>
Wed, 6 Mar 2024 00:30:20 +0000 (16:30 -0800)
committerBruno Haible <bruno@clisp.org>
Wed, 6 Mar 2024 02:34:50 +0000 (03:34 +0100)
Follow gnulib-tool change
2018-09-03  Bruno Haible  <bruno@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
gnulib-tool.py.TODO
pygnulib/GLEmiter.py
pygnulib/GLImport.py
pygnulib/GLMakefileTable.py

index 33feae3fe573f8c086e94de90a25be5f73d9f533..0d11697d3db526640d31054597705a19a71e1507 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2024-03-05  Collin Funk  <collin.funk1@gmail.com>
+
+       gnulib-tool.py: Follow gnulib-tool changes, part 41.
+       Follow gnulib-tool change
+       2018-09-03  Bruno Haible  <bruno@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.funk1@gmail.com>
 
        gnulib-tool.py: Follow gnulib-tool changes, part 40.
index 72cf630b54551bbdb2d677c34501f95577e8e259..2d8719a751d161c07493ae5753611103e155e99c 100644 (file)
@@ -660,21 +660,6 @@ Date:   Fri Jan 4 19:34:19 2019 +0100
 
 --------------------------------------------------------------------------------
 
-commit 8b1d4a63e34f3893036d82f39c5680e845de5ddf
-Author: Bruno Haible <bruno@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.luong@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 <bruno@clisp.org>
 Date:   Sun Oct 29 16:57:32 2017 +0100
index 66833c4e98b490744ae8c0a5e93e4e9980c5cb05..ee963e69d78164ee9fc4bfffe12ced7bba647a82 100644 (file)
@@ -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'
index 2f6e06a8bb0a9edd8516ad70ae251732bd35b458..3075dc3e47ef5091455b6c9c7e5891b844e8824b 100644 (file)
@@ -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()
 
index 9f6fa548e1d11ab82d0fccc69b098ade8f9eba78..a63c2d68990fdd7726a4786287f1c9247237809d 100644 (file)
@@ -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):