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