From 081643519481b02362cbc5a9530e13aba2bfcb9b Mon Sep 17 00:00:00 2001 From: Collin Funk Date: Sat, 9 Mar 2024 20:05:10 -0800 Subject: [PATCH 2/2] gnulib-tool.py: Follow gnulib-tool changes, part 52. Follow gnulib-tool change 2021-12-15 Bruno Haible automake-subdir support: Look for 'subdir-objects' also in configure.ac. * pygnulib/GLImport.py (GLImport.__init__): Check for 'subdir-objects' in the AM_INIT_AUTOMAKE macro of configure.ac. --- ChangeLog | 9 +++++++++ gnulib-tool.py.TODO | 11 ----------- pygnulib/GLImport.py | 12 ++++++++++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index f13d759bb4..8dda625922 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2024-03-09 Collin Funk + + gnulib-tool.py: Follow gnulib-tool changes, part 52. + Follow gnulib-tool change + 2021-12-15 Bruno Haible + automake-subdir support: Look for 'subdir-objects' also in configure.ac. + * pygnulib/GLImport.py (GLImport.__init__): Check for 'subdir-objects' + in the AM_INIT_AUTOMAKE macro of configure.ac. + 2024-03-09 Collin Funk gnulib-tool.py: Follow gnulib-tool changes, part 51. diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO index 51e6cd9e18..e6c94c8bb8 100644 --- a/gnulib-tool.py.TODO +++ b/gnulib-tool.py.TODO @@ -305,17 +305,6 @@ Date: Sun Dec 19 12:49:16 2021 +0100 -------------------------------------------------------------------------------- -commit b8124d982f454b8526b5e11934a2f71faac2b600 -Author: Bruno Haible -Date: Wed Dec 15 21:49:41 2021 +0100 - - automake-subdir support: Look for 'subdir-objects' also in configure.ac. - - * gnulib-tool: Look for the automake options also in the first argument - of the AM_INIT_AUTOMAKE invocation in configure.ac. - --------------------------------------------------------------------------------- - commit 4b071c115309079528db7b60e8d2ffb22b129088 Author: Paul Eggert Date: Mon Apr 26 23:31:29 2021 -0700 diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py index 2ebad91da5..ed0139fe3c 100644 --- a/pygnulib/GLImport.py +++ b/pygnulib/GLImport.py @@ -260,9 +260,17 @@ class GLImport(object): self.config.setModules(modules) if self.config['automake_subdir']: - found_subdir_objects = False + automake_options = set() + if self.config['configure_ac']: + pattern = re.compile(r'^.*AM_INIT_AUTOMAKE\([\[ ]*([^\]\)]*).*$', re.MULTILINE) + with open(self.config['configure_ac'], encoding='utf-8') as file: + data = file.read() + configure_ac_automake_options = pattern.findall(data) + if configure_ac_automake_options: + automake_options = {x for y in configure_ac_automake_options for x in y.split()} + found_subdir_objects = 'subdir-objects' in automake_options base = self.config['destdir'] if self.config['destdir'] else '.' - if isfile(joinpath(base, 'Makefile.am')): + if not found_subdir_objects and isfile(joinpath(base, 'Makefile.am')): pattern = re.compile(r'^AUTOMAKE_OPTIONS[\t| ]*=(.*)$', re.MULTILINE) with open(joinpath(base, 'Makefile.am'), encoding='utf-8') as file: data = file.read() -- 2.44.0