summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2019-12-05 16:13:09 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2019-12-05 16:13:09 +0200
commitdc6974545e7e4dd2e23e1a5e3df9b4692dee9d4b (patch)
tree5d978cdcb670398495930819eaae6d0b30e07064
parente4a0ee205d23a3d3af9dab9685ec330a41e553d5 (diff)
downloadmeson-objcleanup.tar.gz
Clean stray .o file that LDC creates during tests.objcleanup
-rw-r--r--mesonbuild/environment.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
index d81f34feb..905a218fe 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)