This patch adds the reminders to use AC_PROG_CC macro instead of
the obsolete AC_PROG_CC_STDC or AC_PROG_CC_C99.

This change is pretty small so it seemed like a good place to remove
the exit() from GLImport.execute(). The output differs slightly from
the shell script but shouldn't be too much work to fix.

The only spooky line is:

    sp.call(['rm', '-rf', self.config['tempdir']], shell=False)

but this seems generally safe to me. The GLConfig's tempdir is set
unconditionally before anything else is done in GLConfig.__init__()
using mkdtemp(). Since a GLConfig object is always created in
GLImport.__init__() it seems that self.config['tempdir'] will always
be a safe directory to remove in '/tmp', or similar. That is the hope
atleast.

Here is a test script that I used if you would like to double check:

gnulib-tool.py --create-testdir --dir test-python readme-release
gnulib-tool --create-testdir --dir test-shell readme-release
# Comment one and check the other.
sed -i -e 's/AC_PROG_CC/AC_PROG_CC_STDC/g' test-python/configure.ac 
test-shell/configure.ac
#sed -i -e 's/AC_PROG_CC/AC_PROG_CC_C99/g' test-python/configure.ac 
test-shell/configure.ac
cd test-python
gnulib-tool.py --import --with-tests fts > stdout
cd ..
cd test-shell
gnulib-tool --import --with-tests fts > stdout
cd ..
git diff --no-index test-python test-shell

Collin
From 8c18958449689f7bcd82b172e535d9830f90451a Mon Sep 17 00:00:00 2001
From: Collin Funk <[email protected]>
Date: Tue, 12 Mar 2024 13:01:50 -0700
Subject: [PATCH] gnulib-tool.py: Follow gnulib-tool changes, part 56.

Follow gnulib-tool change
2021-04-26  Paul Eggert  <[email protected]>
gnulib-tool: port better to current Autoconf

* pygnulib/GLImport.py (GLImport.execute): Remove exit() call before
printing reminders. Suggest replacing AC_PROG_CC_STDC and
AC_PROG_CC_C99, as per current Autoconf.
---
 ChangeLog            | 10 ++++++++++
 gnulib-tool.py.TODO  | 15 ---------------
 pygnulib/GLImport.py |  3 ++-
 3 files changed, 12 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 180ca802cd..ff9cca6439 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2024-03-12  Collin Funk  <[email protected]>
+
+	gnulib-tool.py: Follow gnulib-tool changes, part 56.
+	Follow gnulib-tool change
+	2021-04-26  Paul Eggert  <[email protected]>
+	gnulib-tool: port better to current Autoconf
+	* pygnulib/GLImport.py (GLImport.execute): Remove exit() call before
+	printing reminders. Suggest replacing AC_PROG_CC_STDC and
+	AC_PROG_CC_C99, as per current Autoconf.
+
 2024-03-12  Collin Funk  <[email protected]>
 
 	gnulib-tool.py: Fix last commit.
diff --git a/gnulib-tool.py.TODO b/gnulib-tool.py.TODO
index 47e3fe56dc..d4de551976 100644
--- a/gnulib-tool.py.TODO
+++ b/gnulib-tool.py.TODO
@@ -24,8 +24,6 @@ Implement the options:
   -H | --more-hardlinks
   --help (same output)
 
-Remove exit() in GLImport.py.
-
 Optimize:
   - os.chdir around subprocess creation -> cwd=... argument instead.
   - Inline all 'sed' invocations.
@@ -156,19 +154,6 @@ Date:   Sun Dec 19 12:49:16 2021 +0100
 
 --------------------------------------------------------------------------------
 
-commit 4b071c115309079528db7b60e8d2ffb22b129088
-Author: Paul Eggert <[email protected]>
-Date:   Mon Apr 26 23:31:29 2021 -0700
-
-    gnulib-tool: port better to current Autoconf
-
-    * doc/gnulib-tool.texi (Initial import): Don’t mention
-    AC_PROG_CC_STDC as it’s deprecated in current Autoconf.
-    * gnulib-tool (func_done_dir): Suggest replacing
-    AC_PROG_CC_STDC and AC_PROG_CC_C99, as per current Autoconf.
-
---------------------------------------------------------------------------------
-
 commit 0be855ee827bf7e9043eeb626c4fd847704be2e6
 Author: Bruno Haible <[email protected]>
 Date:   Tue Dec 29 02:48:31 2020 +0100
diff --git a/pygnulib/GLImport.py b/pygnulib/GLImport.py
index db8c1c24a6..c65ba7d3f7 100644
--- a/pygnulib/GLImport.py
+++ b/pygnulib/GLImport.py
@@ -1417,7 +1417,6 @@ AC_DEFUN([%s_FILE_LIST], [\n''' % macro_prefix
                 elif operand == '|R|':
                     last_dirs_removed += [filename]
             self._done_dir_(last_dir, last_dirs_added, last_dirs_removed)
-        exit()
 
         # Finish the work.
         print('Finished.\n')
@@ -1499,8 +1498,10 @@ in <library>_a_LDFLAGS or <library>_la_LDFLAGS when linking a library.''')
         match_result2 = \
             bool(re.compile('^ *AC_PROG_CC_C99', re.M).findall(data))
         if match_result1:
+            print('  - replace AC_PROG_CC_STDC with AC_PROG_CC in %s,' % (configure_ac))
             position_early_after = 'AC_PROG_CC_STDC'
         elif match_result2:
+            print('  - replace AC_PROG_CC_C99 with AC_PROG_CC in %s,' % (configure_ac))
             position_early_after = 'AC_PROG_CC_C99'
         else:  # if not any([match_result1, match_result2])
             position_early_after = 'AC_PROG_CC'
-- 
2.44.0

Reply via email to