+2024-03-19 Collin Funk <collin.funk1@gmail.com>
+
+ gnulib-tool.py: Follow gnulib-tool changes, part 65.
+ Follow gnulib-tool change
+ 2021-12-19 Bruno Haible <bruno@clisp.org>
+ gnulib-tool: Don't insist on ACLOCAL_AMFLAGS.
+ * pygnulib/GLImport.py (GLImport.execute): Don't add extra '-I' before
+ m4 directory in ACLOCAL_AMFLAGS. Prefer '0' instead of 'int()'. Mention
+ the use of AC_CONFIG_MACRO_DIRS in configure.ac as an alternative to
+ augmenting ACLOCAL_AMFLAGS.
+ * pygnulib/main.py (main): To find the m4 directories, look also for
+ AC_CONFIG_MACRO_DIR and AC_CONFIG_MACRO_DIRS invocations in
+ configure.ac. Remove unnecessary call to 'joinpath' since it accepts a
+ variable length of arguments.
+
2024-03-18 Bruno Haible <bruno@clisp.org>
gnulib-tool.py: Tweak last change.
--------------------------------------------------------------------------------
-commit 4bdc327dbda59dcdbfa0f983a4f35c4a4ec3578c
-Author: Bruno Haible <bruno@clisp.org>
-Date: Sun Dec 19 12:49:16 2021 +0100
-
- gnulib-tool: Don't insist on ACLOCAL_AMFLAGS.
-
- Reported by Bjarni Ingi Gislason <bjarniig@rhi.hi.is> in
- <https://lists.gnu.org/archive/html/bug-gnulib/2021-12/msg00112.html>.
-
- * gnulib-tool (func_import): Mention an AC_CONFIG_MACRO_DIRS invocation
- as an alternative to augmenting ACLOCAL_AMFLAGS.
- (--import, --add-import, --remove-import, --update): To find the m4
- directories, look also for AC_CONFIG_MACRO_DIR and AC_CONFIG_MACRO_DIRS
- invocations in configure.ac.
-
---------------------------------------------------------------------------------
-
commit 30459fe101541698ec704acb224946d73676750e
Author: Bruno Haible <bruno@clisp.org>
Date: Thu Jun 8 15:09:31 2017 +0200
testsbase_dir = os.path.dirname(testsbase)
testsbase_base = os.path.basename(testsbase)
self.makefiletable.editor(testsbase_dir, 'SUBDIRS', testsbase_base, True)
- self.makefiletable.editor('', 'ACLOCAL_AMFLAGS', '-I %s' % m4base)
+ self.makefiletable.editor('', 'ACLOCAL_AMFLAGS', m4base)
self.makefiletable.parent(gentests, source_makefile_am, tests_makefile_am)
# Create library makefile.
else: # if makefile_am != 'Makefile.am'
print(' - "include %s" from within "%s/Makefile.am",' % (tests_makefile_am, testsbase))
# Print makefile edits.
- current_edit = int()
+ current_edit = 0
makefile_am_edits = self.makefiletable.count()
while current_edit != makefile_am_edits:
dictionary = self.makefiletable[current_edit]
if dictionary['var']:
- print(' - mention "%s" in %s in %s,'
- % (dictionary['val'], dictionary['var'], joinpath(dictionary['dir'], 'Makefile.am')))
+ if dictionary['var'] == 'ACLOCAL_AMFLAGS':
+ print(' - mention "-I %s" in %s in %s'
+ % (dictionary['val'], dictionary['var'], joinpath(dictionary['dir'], 'Makefile.am')))
+ print(' or add an AC_CONFIG_MACRO_DIRS([%s]) invocation in %s,'
+ % (dictionary['val'], configure_ac))
+ else:
+ print(' - mention "%s" in %s in %s,'
+ % (dictionary['val'], dictionary['var'], joinpath(dictionary['dir'], 'Makefile.am')))
current_edit += 1
# Detect position_early_after.
destdir = '.'
config.setDestDir(destdir)
+ # Analyze configure.ac.
+ with open(joinpath(destdir, 'configure.ac'), 'r', encoding='utf-8') as file:
+ configure_ac_data = file.read()
+
+ guessed_m4dirs = []
+ pattern = re.compile(r'^.*AC_CONFIG_MACRO_DIRS?\([\[ ]*([^\]"\$`\\\)]*).*$', re.MULTILINE)
+ match = pattern.findall(configure_ac_data)
+ # Append the match to guessed_m4dirs.
+ if match:
+ guessed_m4dirs += match
+
if mode == MODES['import']:
# Set variables to default values.
if not sourcebase:
if dirisnext:
# Ignore absolute directory pathnames, like /usr/local/share/aclocal.
if not isabs(aclocal_amflag):
- if isfile(joinpath(destdir, joinpath(aclocal_amflag, 'gnulib-cache.m4'))):
+ if isfile(joinpath(destdir, aclocal_amflag, 'gnulib-cache.m4')):
m4dirs += [aclocal_amflag]
dirisnext = False
else: # if not dirisnext
dirisnext = True
else: # if aclocal_amflag != '-I'
dirisnext = False
+ for arg in guessed_m4dirs:
+ # Ignore absolute directory pathnames, like /usr/local/share/aclocal.
+ if not isabs(arg):
+ if isfile(joinpath(destdir, arg, 'gnulib-cache.m4')):
+ m4dirs += [arg]
else: # if not isfile(filepath)
# No Makefile.am! Oh well. Look at the last generated aclocal.m4.
filepath = joinpath(destdir, 'aclocal.m4')