Fix compiler detection on Windows (#2136)

Signed-off-by: Toby Harradine <t.harradine@student.unsw.edu.au>
This commit is contained in:
Toby Harradine 2018-09-18 14:07:50 +10:00 committed by GitHub
parent 61652a0306
commit 17139ce439
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -42,13 +42,12 @@ def check_compiler_available():
m = ccompiler.new_compiler() m = ccompiler.new_compiler()
with tempfile.TemporaryDirectory() as tdir: with tempfile.TemporaryDirectory() as tdir:
with tempfile.NamedTemporaryFile(prefix="dummy", suffix=".c", dir=tdir) as tfile: with open(os.path.join(tdir, "dummy.c"), "w") as tfile:
tfile.write(b"int main(int argc, char** argv) {return 0;}") tfile.write("int main(int argc, char** argv) {return 0;}")
tfile.seek(0) try:
try: m.compile([tfile.name], output_dir=tdir)
m.compile([tfile.name], output_dir=tdir) except (CCompilerError, DistutilsPlatformError):
except (CCompilerError, DistutilsPlatformError): return False
return False
return True return True