On 2/21/24 8:08 AM, Bruno Haible wrote:
> I suppose it is not much more work to fix this line for real?
> Hints:
>   - If there is no variable 'saved_auxdir' in this function, maybe there
>     is a variable 'auxdir'?
>   - What do the comments hint at?
>   - What does the history of the file ('gitk pygnulib/GLTestDir.py',
>     'git annotate pygnulib/GLTestDir.py') tell you?

Thanks for the tips. I should have done that in the first place...
I think that this patch would be the correct way to fix the issue.

It seems that your commit 01cd78f9d682ff75cc5ab1c2d21b911bdd9215b8
accidentally caused this. While cleaning up the handling of paths, I
think you accidentally removed this variable. This patch seems to
restore the behavior of the previous commits.

Then:
        gnulib-tool --create-testdir --dir t1 dummy
        gnulib-tool.py --create-testdir --dir t2 dummy

Both t1/gltests/configure.ac and t2/gltests/configure.ac start with:

# Process this file with autoconf to produce a configure script.
AC_INIT([dummy], [0])
AC_CONFIG_AUX_DIR([../build-aux])
AM_INIT_AUTOMAKE

Not a complete test but better than before :)
From b2ee9537298dd76d683ec9c4298f22c53f45f6f5 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Wed, 21 Feb 2024 08:54:51 -0800
Subject: [PATCH] gnulib-tool.py: Fix undefined variable while emitting
 testdir.

* pygnulib/GLTestDir.py (GLTestDir.execute): Fix undefined
variable refrence caused by commit
01cd78f9d682ff75cc5ab1c2d21b911bdd9215b8.
Restore the previous auxdir when finished writing the
configure.ac file in the test directory.
---
 ChangeLog             | 9 +++++++++
 pygnulib/GLTestDir.py | 1 +
 2 files changed, 10 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 9779a09ac6..e313032178 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-02-21  Collin Funk  <collin.fu...@gmail.com>
+
+	gnulib-tool.py: Fix undefined variable while emitting testdir.
+	* pygnulib/GLTestDir.py (GLTestDir.execute): Fix undefined
+	variable refrence caused by commit
+	01cd78f9d682ff75cc5ab1c2d21b911bdd9215b8.
+	Restore the previous auxdir when finished writing the
+	configure.ac file in the test directory.
+
 2024-02-21  Bruno Haible  <br...@clisp.org>
 
 	*printf-posix: Disable support for the 'n' directive by default.
diff --git a/pygnulib/GLTestDir.py b/pygnulib/GLTestDir.py
index ae8537cff4..144798bd01 100644
--- a/pygnulib/GLTestDir.py
+++ b/pygnulib/GLTestDir.py
@@ -406,6 +406,7 @@ class GLTestDir(object):
                     file.write(emit)
                 # Viewed from the $testsbase subdirectory, $auxdir is different.
                 emit = ''
+                saved_auxdir = auxdir
                 auxdir = os.path.normpath(joinpath(relinverse(testsbase), auxdir))
                 self.config.setAuxDir(auxdir)
                 # Create $testsbase/configure.ac.
-- 
2.39.2

Reply via email to