]> git.ipfire.org Git - thirdparty/gnulib.git/commitdiff
gnulib-tool.py: Allow the use of both configure.ac and configure.in.
authorCollin Funk <collin.funk1@gmail.com>
Tue, 26 Mar 2024 22:43:21 +0000 (15:43 -0700)
committerBruno Haible <bruno@clisp.org>
Tue, 26 Mar 2024 23:05:33 +0000 (00:05 +0100)
* pygnulib/GLImport.py (GLImport.__init__): Remove redundant checks for
configure.ac and configure.in.
* pygnulib/main.py (main): Check for configure.ac and configure.in
before reading it. Pass it to GLImport using the GLConfig object.

ChangeLog
pygnulib/GLImport.py
pygnulib/main.py

index 94fc26fb449fb7459a709d9964c0c9bea1031dd4..e70c0e9271cc2f26d68192f5c0f3d645d6dec15a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2024-03-26  Collin Funk  <collin.funk1@gmail.com>
+
+       gnulib-tool.py: Allow the use of both configure.ac and configure.in.
+       * pygnulib/GLImport.py (GLImport.__init__): Remove redundant checks for
+       configure.ac and configure.in.
+       * pygnulib/main.py (main): Check for configure.ac and configure.in
+       before reading it. Pass it to GLImport using the GLConfig object.
+
 2024-03-26  Bruno Haible  <bruno@clisp.org>
 
        gettime-res: Fix test failure on Solaris 11.4/SPARC.
index 1a45776f4f5e2e860e57318e8080792afcdf1b9e..d7d820f8d1d047f7e804646c30c9a5fd4feac26b 100644 (file)
@@ -89,13 +89,7 @@ class GLImport(object):
 
         # Get cached auxdir and libtool from configure.ac/in.
         self.cache.setAuxDir('.')
-        path = joinpath(self.config['destdir'], 'configure.ac')
-        if not isfile(path):
-            path = joinpath(self.config['destdir'], 'configure.in')
-            if not isfile(path):
-                raise GLError(3, path)
-        self.config.setAutoconfFile(path)
-        with codecs.open(path, 'rb', 'UTF-8') as file:
+        with codecs.open(self.config.getAutoconfFile(), 'rb', 'UTF-8') as file:
             data = file.read()
         pattern = re.compile(r'^AC_CONFIG_AUX_DIR\((.*)\)$', re.M)
         match = pattern.findall(data)
index c83612d91f7dce01e92515694711ed0107ce0694..204050facbb3a5c3ab4da4f076db2024a61dd630 100644 (file)
@@ -886,8 +886,19 @@ def main():
             destdir = '.'
         config.setDestDir(destdir)
 
+        # Prefer configure.ac but also look for configure.in.
+        if isfile(joinpath(destdir, 'configure.ac')):
+            configure_ac = joinpath(destdir, 'configure.ac')
+        elif isfile(joinpath(destdir, 'configure.in')):
+            configure_ac = joinpath(destdir, 'configure.in')
+        else:
+            raise classes.GLError(3, joinpath(destdir, 'configure.ac'))
+
+        # Save the Autoconf file path for the rest of the import.
+        config.setAutoconfFile(configure_ac)
+
         # Analyze configure.ac.
-        with open(joinpath(destdir, 'configure.ac'), 'r', encoding='utf-8') as file:
+        with open(configure_ac, 'r', encoding='utf-8') as file:
             configure_ac_data = file.read()
 
         guessed_m4dirs = []