X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=senfscons%2FCompileCheck.py;h=95358a112897d3f0ed85c33fad1931e5bc8a9a5f;hb=b8ca4a544cce3e6023bb56b712a03d6362f2bb79;hp=34d3617818656b7cd8932b3c2406d82816cd0828;hpb=80c6cb7ba9ad7776824c84809f422209adf27331;p=senf.git diff --git a/senfscons/CompileCheck.py b/senfscons/CompileCheck.py index 34d3617..95358a1 100644 --- a/senfscons/CompileCheck.py +++ b/senfscons/CompileCheck.py @@ -1,4 +1,5 @@ import os, os.path, sys +import tempfile from SCons.Script import * import SCons.Scanner.C @@ -14,13 +15,19 @@ def scanTests(f): elif line.startswith('}') and name and start: tests[name] = (start, linenr) return tests - + def CompileCheck(target, source, env): tests = scanTests(file(source[0].abspath)) - errf = os.popen(env.subst('$CXXCOM -DCOMPILE_CHECK 2>&1', source=source, target=target)) + cenv = env.Clone() + cenv.Append( CPPDEFINES = { 'COMPILE_CHECK': '' } ) + out = tempfile.TemporaryFile() + cenv['SPAWN'] = lambda sh, escape, cmd, args, env, pspawn=cenv['PSPAWN'], out=out: \ + pspawn(sh, escape, cmd, args, env, out, out) + Action('$CXXCOM').execute(target, source, cenv) passedTests = {} delay_name = None - for error in errf: + out.seek(0) + for error in out.read().splitlines(): elts = error.split(':',2) if len(elts) != 3 : continue filename, line, message = elts