aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/project/boost/archive.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-03-30 00:13:20 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-03-30 00:53:14 +0300
commit8a8941b853ba5ccecc65cf55222c6c129e92d675 (patch)
treed3a251cdfe4be68914f43103876d908930314bb4 /project/boost/archive.py
parentproject.boost: first-class MinGW-w64 support (diff)
downloadcmake-common-8a8941b853ba5ccecc65cf55222c6c129e92d675.tar.gz
cmake-common-8a8941b853ba5ccecc65cf55222c6c129e92d675.zip
project: minor-ish refactoring
Diffstat (limited to '')
-rw-r--r--project/boost/archive.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/project/boost/archive.py b/project/boost/archive.py
index e4c85e0..5316005 100644
--- a/project/boost/archive.py
+++ b/project/boost/archive.py
@@ -8,9 +8,9 @@ from contextlib import contextmanager
import logging
import os.path
import shutil
-import tempfile
from project.boost.directory import BoostDir
+from project.utils import temp_file
class Archive:
@@ -75,15 +75,7 @@ class TemporaryStorage(ArchiveStorage):
@contextmanager
def write_archive(self, version, contents):
- temp = tempfile.NamedTemporaryFile(prefix=f'boost_{version}_',
- suffix=version.archive_ext,
- dir=self._dir, delete=False)
- with temp as dest:
- path = dest.name
- logging.info('Writing Boost archive: %s', path)
- dest.write(contents)
- try:
+ tmp = temp_file(contents, prefix=f'boost_{version}_',
+ suffix=version.archive_ext, dir=self._dir)
+ with tmp as path:
yield path
- finally:
- logging.info('Removing temporary Boost archive: %s', path)
- os.remove(path)