File tree Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Expand file tree Collapse file tree 1 file changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -41,14 +41,15 @@ def has_flag(compiler, flagname):
41
41
"""Return a boolean indicating whether a flag name is supported on
42
42
the specified compiler.
43
43
"""
44
- import tempfile
45
- with tempfile .NamedTemporaryFile ('w' , suffix = '.cpp' , delete = False ) as f :
46
- f .write ('int main (int argc, char **argv) { return 0; }' )
47
- fname = f .name
48
- try :
49
- compiler .compile ([fname ], extra_postargs = [flagname ])
50
- except setuptools .distutils .errors .CompileError :
51
- return False
44
+ import tempfile , os
45
+ with tempfile .TemporaryDirectory () as d :
46
+ fname = os .path .join (d , 'main.cpp' )
47
+ with open (fname , 'w' ) as f :
48
+ f .write ('int main (int argc, char **argv) { return 0; }' )
49
+ try :
50
+ compiler .compile ([fname ], extra_postargs = [flagname ])
51
+ except setuptools .distutils .errors .CompileError :
52
+ return False
52
53
return True
53
54
54
55
You can’t perform that action at this time.
0 commit comments