From caf4716632fc6ab1918e42e778451e254ae752f7 Mon Sep 17 00:00:00 2001 From: Elliot Nunn Date: Wed, 17 Jul 2019 11:21:34 +0800 Subject: [PATCH] Use tempfiles for disk image preparation Previously these intermediates were placed in the build directory but immediately deleted. Unless we are going to make them easily available for inspection (hopefully not often required), they should just go in /tmp. --- bin/build | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bin/build b/bin/build index 572ee56..d550279 100755 --- a/bin/build +++ b/bin/build @@ -18,6 +18,7 @@ import shlex import shutil import subprocess import sys +import tempfile @@ -30,8 +31,8 @@ parser.add_argument('passthru', metavar='ARG', nargs='+', help='Build script arg config = parser.parse_args() config.worktree = os.getcwd() -config.tmpdir = path.join(config.worktree, '.dmg') -config.hfsimg = path.join(config.worktree, '.dmg.dmg') +config.tmpdir = tempfile.mkdtemp() +handle, config.hfsimg = tempfile.mkstemp(suffix='.dmg') config.vmac = open(path.join(path.dirname(__file__), 'vmac_path.conf')).read().rstrip('\n')