From a8ec7c4c6430e69953ea8f8f3925d1b0fb4ac63a Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 5 Jun 2012 11:43:43 +0200 Subject: apt/auth.py: create _TMPDIR on demand --- apt/auth.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/apt/auth.py b/apt/auth.py index 04aae908..d8c602fa 100644 --- a/apt/auth.py +++ b/apt/auth.py @@ -36,8 +36,7 @@ from apt_pkg import gettext as _ # Create a temporary dir to store secret keying and trust database. # APT doesn't use a secrect key ring but GnuPG fails without it. -_TMPDIR = tempfile.mkdtemp() -atexit.register(shutil.rmtree, _TMPDIR) +_TMPDIR = None class TrustedKey(object): @@ -57,6 +56,10 @@ class TrustedKey(object): def _get_gpg_command(keyring=None): """Return the gpg command""" + global _TMPDIR + if _TMPDIR is None: + _TMPDIR = tempfile.mkdtemp() + atexit.register(shutil.rmtree, _TMPDIR) cmd = [apt_pkg.config.find_file("Dir::Bin::Gpg", "/usr/bin/gpg"), "--ignore-time-conflict", "--no-default-keyring", -- cgit v1.2.3