Skip to content

Commit

Permalink
Merge 9e1849b into 33dfd04
Browse files Browse the repository at this point in the history
  • Loading branch information
mstimberg committed May 9, 2022
2 parents 33dfd04 + 9e1849b commit 7d2b1b6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions brian2/codegen/cpp_prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,13 @@
def _determine_flag_compatibility(compiler, flagname):
import tempfile
from distutils.errors import CompileError
with tempfile.NamedTemporaryFile('w', suffix='.cpp') as f, std_silent():
f.write('int main (int argc, char **argv) { return 0; }')
with tempfile.TemporaryDirectory(prefix='brian_flag_test_') as temp_dir, std_silent():
fname = os.path.join(temp_dir, 'flag_test.cpp')
with open(fname, 'wt') as f:
f.write('int main (int argc, char **argv) { return 0; }')
try:
compiler.compile([f.name], extra_postargs=[flagname])
compiler.compile([fname], output_dir=temp_dir,
extra_postargs=[flagname])
except CompileError:
logger.warn(f"Removing unsupported flag '{flagname}' from "
f'compiler flags.')
Expand Down

0 comments on commit 7d2b1b6

Please sign in to comment.