From 334a8b099100d495002fb037de04ddb652c756ff Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Thu, 12 Dec 2024 21:09:35 +0100 Subject: [PATCH] ci: remove a custom implementation of a stdlib functionality (#48068) --- lib/spack/spack/ci/__init__.py | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/spack/spack/ci/__init__.py b/lib/spack/spack/ci/__init__.py index 044aa39d689..d7afa2a0910 100644 --- a/lib/spack/spack/ci/__init__.py +++ b/lib/spack/spack/ci/__init__.py @@ -65,18 +65,6 @@ PushResult = namedtuple("PushResult", "success url") -class TemporaryDirectory: - def __init__(self): - self.temporary_directory = tempfile.mkdtemp() - - def __enter__(self): - return self.temporary_directory - - def __exit__(self, exc_type, exc_value, exc_traceback): - shutil.rmtree(self.temporary_directory) - return False - - def get_change_revisions(): """If this is a git repo get the revisions to use when checking for changed packages and spack core modules.""" @@ -525,7 +513,7 @@ def import_signing_key(base64_signing_key): if isinstance(decoded_key, bytes): decoded_key = decoded_key.decode("utf8") - with TemporaryDirectory() as tmpdir: + with tempfile.TemporaryDirectory() as tmpdir: sign_key_path = os.path.join(tmpdir, "signing_key") with open(sign_key_path, "w") as fd: fd.write(decoded_key)