In main.py a call to mkdtemp() was the use of the 'tempfile' module
prefix.
Also, Python seems really good at cleaning up the temporary directory
created with tempfile.TemporaryDirectory() atleast on GNU/Linux.
There might be some ways to interrupt it, or some platform specific
behavior to that. Just in case of that, I put back the 'glpy' prefix.
Collin
From b86d31ade5e8284df1efe339890b674eedf89bcd Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Fri, 3 May 2024 17:26:18 -0700
Subject: [PATCH] gnulib-tool.py: Fix an undefined function name.
* pygnulib/main.py (main_with_exception_handling): Use the tempfile
module prefix when calling mkdtemp(). Use the 'glpy' prefix for the
temporary directory that exists for the entirety of the program.
---
ChangeLog | 7 +++++++
pygnulib/main.py | 4 ++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 2781a70800..96b29b7fc4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2024-05-03 Collin Funk <collin.fu...@gmail.com>
+
+ gnulib-tool.py: Fix an undefined function name.
+ * pygnulib/main.py (main_with_exception_handling): Use the tempfile
+ module prefix when calling mkdtemp(). Use the 'glpy' prefix for the
+ temporary directory that exists for the entirety of the program.
+
2024-05-03 Simon Josefsson <si...@josefsson.org>
maint.mk: Don't fail on ~/.indent.pro, reported by Collin Funk.
diff --git a/pygnulib/main.py b/pygnulib/main.py
index d429a2c47e..66bd67ea59 100644
--- a/pygnulib/main.py
+++ b/pygnulib/main.py
@@ -1364,7 +1364,7 @@ def main(temp_directory: str) -> None:
def main_with_exception_handling() -> None:
try: # Try to execute
- with tempfile.TemporaryDirectory() as temporary_directory:
+ with tempfile.TemporaryDirectory(prefix='glpy') as temporary_directory:
main(temporary_directory)
except GLError as error:
errmode = 0 # gnulib-style errors
@@ -1404,7 +1404,7 @@ def main_with_exception_handling() -> None:
incompatibilities += pair[0]
incompatibilities += ' %s' % pair[1]
incompatibilities += '\n'
- tempname = mktemp()
+ tempname = tempfile.mktemp()
with open(tempname, mode='w', newline='\n', encoding='utf-8') as file:
file.write(incompatibilities)
sed_table = 's,^\\([^ ]*\\) ,\\1' + ' ' * 51 + ',\n'
--
2.44.0