From 1e182b51c63bae7d0354334829de21eb5483ddf3 Mon Sep 17 00:00:00 2001 From: Charlie Barto Date: Fri, 5 Jul 2019 11:59:15 -0700 Subject: Improve performance with windows defender ATP --- mesonbuild/compilers/compilers.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'mesonbuild/compilers/compilers.py') diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 86c1e33..50225c0 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1152,11 +1152,11 @@ class Compiler: return args @contextlib.contextmanager - def compile(self, code, extra_args=None, *, mode='link', want_output=False): + def compile(self, code, extra_args=None, *, mode='link', want_output=False, temp_dir=None): if extra_args is None: extra_args = [] try: - with tempfile.TemporaryDirectory() as tmpdirname: + with tempfile.TemporaryDirectory(dir=temp_dir) as tmpdirname: if isinstance(code, str): srcname = os.path.join(tmpdirname, 'testfile.' + self.default_suffix) @@ -1201,7 +1201,7 @@ class Compiler: pass @contextlib.contextmanager - def cached_compile(self, code, cdata: coredata.CoreData, *, extra_args=None, mode: str = 'link'): + def cached_compile(self, code, cdata: coredata.CoreData, *, extra_args=None, mode: str = 'link', temp_dir=None): assert(isinstance(cdata, coredata.CoreData)) # Calculate the key @@ -1210,7 +1210,7 @@ class Compiler: # Check if not cached if key not in cdata.compiler_check_cache: - with self.compile(code, extra_args=extra_args, mode=mode, want_output=False) as p: + with self.compile(code, extra_args=extra_args, mode=mode, want_output=False, temp_dir=temp_dir) as p: # Remove all attributes except the following # This way the object can be serialized tokeep = ['args', 'commands', 'input_name', 'output_name', -- cgit v1.1