This patch prefixes temporary directories created by gnulib-tool.py
with "glpy". gnulib-tool.sh uses the 'gl' prefix in func_tmpdir, and I
suppose it is beneficial to differentiate the two.

I probably should have done this ~2 months ago when gnulib-tool.py
crashed frequently. After testing my /tmp would be full of directories
named with the template "tmpXXXXXXXX", which I assume gets used by
other programs too. Thankfully that is less of an issue now since
gnulib-tool.py crashes less...

Collin
From 68e59ded4b879011d2a8b3ff3b3342225dcdf312 Mon Sep 17 00:00:00 2001
From: Collin Funk <collin.fu...@gmail.com>
Date: Sun, 21 Apr 2024 00:29:50 -0700
Subject: [PATCH] gnulib-tool.py: Make temporary directories recognizable.

* pygnulib/GLConfig.py (GLConfig.__init__): Pass the 'glpy' prefix to
mkdtemp.
---
 ChangeLog            | 6 ++++++
 pygnulib/GLConfig.py | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 6523c89b87..502cdeeaeb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2024-04-21  Collin Funk  <collin.fu...@gmail.com>
+
+	gnulib-tool.py: Make temporary directories recognizable.
+	* pygnulib/GLConfig.py (GLConfig.__init__): Pass the 'glpy' prefix to
+	mkdtemp.
+
 2024-04-20  Collin Funk  <collin.fu...@gmail.com>
 
 	gnulib-tool.py: Don't fail when given a bad module name.
diff --git a/pygnulib/GLConfig.py b/pygnulib/GLConfig.py
index 19611b823c..05947e8ed3 100644
--- a/pygnulib/GLConfig.py
+++ b/pygnulib/GLConfig.py
@@ -87,7 +87,7 @@ def __init__(self,
                  errors: bool | None = None) -> None:
         '''Create new GLConfig instance.'''
         self.table = dict()
-        self.table['tempdir'] = tempfile.mkdtemp()
+        self.table['tempdir'] = tempfile.mkdtemp(prefix='glpy')
         # Check and store the attributes.
         # Remove trailing slashes from the directory names. This is necessary
         # for m4base (to avoid an error in func_import) and optional for the
-- 
2.44.0

Reply via email to