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):
4141 """Return a boolean indicating whether a flag name is supported on
4242 the specified compiler.
4343 """
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
5253 return True
5354
5455
You can’t perform that action at this time.
0 commit comments