>From 1b4313a18a42c6796b3064e82d45e41c51fcfa7a Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 29 Jul 2022 23:29:23 +0200 Subject: [PATCH 5/5] gnulib-tool.py: Follow gnulib-tool changes, part 17. Follow gnulib-tool change 2015-10-06 Pavel Raiskup gnulib-tool: fix tests of 'extensions' module * pygnulib/GLEmiter.py (GLEmiter.preEarlyMacros): New function. * pygnulib/GLImport.py (GLImport.gnulib_comp): Invoke it. * pygnulib/GLTestDir.py (GLTestDir.execute): Likewise. --- ChangeLog | 8 ++++++++ gnulib-tool.py.TODO | 13 ------------- pygnulib/GLEmiter.py | 25 +++++++++++++++++++++++++ pygnulib/GLImport.py | 4 +--- pygnulib/GLTestDir.py | 6 +++--- 5 files changed, 37 insertions(+), 19 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1ddf2822ad..16119afe29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2022-07-29 Bruno Haible + gnulib-tool.py: Follow gnulib-tool changes, part 17. + Follow gnulib-tool change + 2015-10-06 Pavel Raiskup + gnulib-tool: fix tests of 'extensions' module + * pygnulib/GLEmiter.py (GLEmiter.preEarlyMacros): New function. + * pygnulib/GLImport.py (GLImport.gnulib_comp): Invoke it. + * pygnulib/GLTestDir.py (GLTestDir.execute): Likewise. + gnulib-tool.py: Follow gnulib-tool changes, part 16. Follow gnulib-tool change 2015-09-25 Pavel Raiskup diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO index bcb811b5df..8f535f6897 100644 --- a/gnulib-tool.py.TODO +++ b/gnulib-tool.py.TODO @@ -1121,19 +1121,6 @@ Date: Sat Nov 21 14:09:15 2015 +0100 -------------------------------------------------------------------------------- -commit 63ce1a2103dd4452f7bd5bc873a982e03ed52427 -Author: Pavel Raiskup -Date: Tue Oct 6 13:20:05 2015 +0200 - - gnulib-tool: fix tests of 'extensions' module - - This complements f8fe25fab60e3c687a124 commit. - - * gnulib-tool (func_emit_pre_early_macros): New function, it wraps - emitting of initial gl_EARLY macros. - (func_import, func_create_testdir): All dumps of gl_PROG_AR_RANLIB - replaced with func_emit_pre_early_macros call. - commit 9bdf6c8a0cdeb13c12e4b65dee9538c5468dbe1d Author: Bruno Haible Date: Sun Aug 19 14:06:50 2012 +0200 diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py index 8f20990f16..0d57b6177b 100644 --- a/pygnulib/GLEmiter.py +++ b/pygnulib/GLEmiter.py @@ -373,6 +373,31 @@ add AM_GNU_GETTEXT([external]) or similar to configure.ac.') emit = emit.decode(ENCS['default']) return emit + def preEarlyMacros(self, require, indentation, modules): + '''GLEmiter.preEarlyMacros(require, indentation, modules) -> string + + Collect and emit the pre-early section. + + require parameter can be True (AC_REQUIRE) or False (direct call). + indentation parameter is a string. + modules argument represents list of modules; every module in this list must + be a GLModule instance.''' + emit = string() + emit += '\n' + indentation + '# Pre-early section.\n' + # We need to call gl_USE_SYSTEM_EXTENSIONS before gl_PROG_AR_RANLIB. + # Doing AC_REQUIRE in configure-ac.early is not early enough. + if any(str(module) == 'extensions' for module in modules): + if require: + emit += indentation + 'AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])\n' + else: + emit += indentation + 'gl_USE_SYSTEM_EXTENSIONS\n' + if require: + emit += indentation + 'AC_REQUIRE([gl_PROG_AR_RANLIB])\n' + else: + emit += indentation + 'gl_PROG_AR_RANLIB\n' + emit += '\n' + return emit + def po_Makevars(self): '''GLEmiter.po_Makevars() -> string diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py index c51b5036df..06c122e780 100644 --- a/pygnulib/GLImport.py +++ b/pygnulib/GLImport.py @@ -599,9 +599,7 @@ AC_DEFUN([%s_EARLY], m4_pattern_allow([^gl_ES$])dnl a valid locale name m4_pattern_allow([^gl_LIBOBJS$])dnl a variable m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable\n''' % (configure_ac, macro_prefix) - if any(str(module) == 'extensions' for module in moduletable['final']): - emit += ' AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])\n' - emit += ' AC_REQUIRE([gl_PROG_AR_RANLIB])\n' + emit += self.emiter.preEarlyMacros(True, ' ', moduletable['final']) uses_subdirs = False for module in moduletable['main']: # Test whether there are some source files in subdirectories. diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py index 6433a0d78c..0a403c993f 100644 --- a/pygnulib/GLTestDir.py +++ b/pygnulib/GLTestDir.py @@ -441,7 +441,7 @@ class GLTestDir(object): emit += 'AC_PROG_CC\n' emit += 'AC_PROG_INSTALL\n' emit += 'AC_PROG_MAKE_SET\n' - emit += 'gl_PROG_AR_RANLIB\n\n' + emit += self.emiter.preEarlyMacros(False, '', modules) if uses_subdirs: emit += 'AM_PROG_CC_C_O\n\n' snippets = list() @@ -561,8 +561,8 @@ class GLTestDir(object): emit += 'm4_pattern_forbid([^gl_[A-Z]])dnl the gnulib macro namespace\n' emit += 'm4_pattern_allow([^gl_ES$])dnl a valid locale name\n' emit += 'm4_pattern_allow([^gl_LIBOBJS$])dnl a variable\n' - emit += 'm4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable\n\n' - emit += 'gl_PROG_AR_RANLIB\n\n' + emit += 'm4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable\n' + emit += self.emiter.preEarlyMacros(False, '', modules) if any_uses_subdirs: emit += 'AM_PROG_CC_C_O\n' snippets = list() -- 2.34.1