From 6eead93425dba15bf7aeb08733256f7e1661a482 Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Tue, 5 Mar 2024 01:55:08 -0800 Subject: [PATCH 1/2] gnulib-tool.py: Follow gnulib-tool changes, part 41. Follow gnulib-tool change 2018-09-03 Bruno Haible 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 06937dcba0..565d61dafa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2024-03-05 Collin Funk + + gnulib-tool.py: Follow gnulib-tool changes, part 41. + Follow gnulib-tool change + 2018-09-03 Bruno Haible + 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-04 Collin Funk 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 -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 in - . - - * 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 Date: Sun Oct 29 16:57:32 2017 +0100 diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py index 66833c4e98..57aeff1ae4 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['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['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 9cf9a96e30..0bac4ad18a 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. + .''' 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