From 63bea704dded2cd6712e1386c5beb69be688c9f7 Mon Sep 17 00:00:00 2001 From: Jussi Pakkanen Date: Thu, 5 Dec 2019 16:13:09 +0200 Subject: Clean stray .o file that LDC creates during tests. --- mesonbuild/environment.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mesonbuild/environment.py') diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index d81f34f..905a218 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -1385,10 +1385,18 @@ class Environment: linker = ClangClDynamicLinker(for_machine, version=search_version(o)) else: with tempfile.NamedTemporaryFile(suffix='.d') as f: + # LDC writes an object file to the current working directory. + # Clean it up. + objectfile = os.path.basename(f.name)[:-1] + 'o' linker = self._guess_nix_linker( exelist, for_machine, compilers.LLVMDCompiler.LINKER_PREFIX, extra_args=[f.name]) + try: + os.unlink(objectfile) + except Exception: + # Thank you Windows file system semantics and virus scanners. + pass return compilers.LLVMDCompiler( exelist, version, for_machine, info, arch, full_version=full_version, linker=linker) -- cgit v1.1