summaryrefslogtreecommitdiffstats
path: root/src/script
diff options
context:
space:
mode:
authorMats Wichmann <mats@linux.com>2019-03-28 14:06:52 (GMT)
committerMats Wichmann <mats@linux.com>2019-03-29 17:54:27 (GMT)
commitf4090a380132898099199a9ae23c0cfabdcc921f (patch)
treec31027d64d1a23e961067801fc0da7cb058056e2 /src/script
parentef365f18a6ab6917530be9c96ea58267fe8eba83 (diff)
downloadSCons-f4090a380132898099199a9ae23c0cfabdcc921f.zip
SCons-f4090a380132898099199a9ae23c0cfabdcc921f.tar.gz
SCons-f4090a380132898099199a9ae23c0cfabdcc921f.tar.bz2
[PR #3330] try to eliminate race in scons-time
runtest change to run requested number of jobs exposed a concurrency problem on Appveyor CI (Windows) builds - which seems to be due to scons-time using mktemp to create a temporary directory name, and then later creating the directory. In scons-time the timing window for this is a bit longer than usual. Try using mkdtemp instead. Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'src/script')
-rw-r--r--src/script/scons-time.py26
1 files changed, 3 insertions, 23 deletions
diff --git a/src/script/scons-time.py b/src/script/scons-time.py
index 5d0a042..2ca3070 100644
--- a/src/script/scons-time.py
+++ b/src/script/scons-time.py
@@ -42,21 +42,6 @@ import sys
import tempfile
import time
-def make_temp_file(**kw):
- try:
- result = tempfile.mktemp(**kw)
- result = os.path.realpath(result)
- except TypeError:
- try:
- save_template = tempfile.template
- prefix = kw['prefix']
- del kw['prefix']
- tempfile.template = prefix
- result = tempfile.mktemp(**kw)
- finally:
- tempfile.template = save_template
- return result
-
def HACK_for_exec(cmd, *args):
"""
For some reason, Python won't allow an exec() within a function
@@ -1239,7 +1224,7 @@ class SConsTimer(object):
return os.path.join(dir, 'src', 'engine')
def prep_aegis_run(self, commands, removals):
- self.aegis_tmpdir = make_temp_file(prefix = self.name + '-aegis-')
+ self.aegis_tmpdir = tempfile.mkdtemp(prefix=self.name + '-aegis-')
removals.append((shutil.rmtree, 'rm -rf %%s', self.aegis_tmpdir))
self.aegis_parent_project = os.path.splitext(self.aegis_project)[0]
@@ -1247,21 +1232,19 @@ class SConsTimer(object):
self.scons_lib_dir = self.scons_lib_dir_path(self.aegis_tmpdir)
commands.extend([
- 'mkdir %(aegis_tmpdir)s',
(lambda: os.chdir(self.aegis_tmpdir), 'cd %(aegis_tmpdir)s'),
'%(aegis)s -cp -ind -p %(aegis_parent_project)s .',
'%(aegis)s -cp -ind -p %(aegis_project)s -delta %(run_number)s .',
])
def prep_subversion_run(self, commands, removals):
- self.svn_tmpdir = make_temp_file(prefix = self.name + '-svn-')
+ self.svn_tmpdir = tempfile.mkdtemp(prefix=self.name + '-svn-')
removals.append((shutil.rmtree, 'rm -rf %%s', self.svn_tmpdir))
self.scons = self.scons_path(self.svn_tmpdir)
self.scons_lib_dir = self.scons_lib_dir_path(self.svn_tmpdir)
commands.extend([
- 'mkdir %(svn_tmpdir)s',
'%(svn)s co %(svn_co_flag)s -r %(run_number)s %(subversion_url)s %(svn_tmpdir)s',
])
@@ -1308,11 +1291,9 @@ class SConsTimer(object):
if self.targets2 is None:
self.targets2 = self.targets
- self.tmpdir = make_temp_file(prefix = self.name + '-')
+ self.tmpdir = tempfile.mkdtemp(prefix=self.name + '-')
commands.extend([
- 'mkdir %(tmpdir)s',
-
(os.chdir, 'cd %%s', self.tmpdir),
])
@@ -1365,7 +1346,6 @@ class SConsTimer(object):
if not os.environ.get('PRESERVE'):
commands.extend(removals)
-
commands.append((shutil.rmtree, 'rm -rf %%s', self.tmpdir))
self.run_command_list(commands, self.__dict__)