File tree Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Expand file tree Collapse file tree 1 file changed +9
-9
lines changed Original file line number Diff line number Diff line change @@ -40,18 +40,18 @@ def has_flag(compiler, flagname):
40
40
"""
41
41
import tempfile
42
42
import os
43
- with tempfile .NamedTemporaryFile ('w' , suffix = '.cpp' ) as f :
43
+ with tempfile .NamedTemporaryFile ('w' , suffix = '.cpp' , delete = False ) as f :
44
44
f .write ('int main (int argc, char **argv) { return 0; }' )
45
45
fname = f .name
46
+ try :
47
+ compiler .compile ([fname ], extra_postargs = [flagname ])
48
+ except setuptools .distutils .errors .CompileError :
49
+ return False
50
+ finally :
46
51
try :
47
- compiler .compile ([fname ], extra_postargs = [flagname ])
48
- except setuptools .distutils .errors .CompileError :
49
- return False
50
- finally :
51
- try :
52
- os .remove (fname )
53
- except OSError :
54
- pass
52
+ os .remove (fname )
53
+ except OSError :
54
+ pass
55
55
return True
56
56
57
57
You can’t perform that action at this time.
0 commit comments