"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "SCons/Tool/gcc.py" between
SCons-4.3.0.tar.gz and SCons-4.4.0.tar.gz

About: SCons is a software construction tool (a Python script and a set of modules as a superior alternative to the classic "Make" build tool).

gcc.py  (SCons-4.3.0):gcc.py  (SCons-4.4.0)
skipping to change at line 59 skipping to change at line 59
if env['PLATFORM'] in ['cygwin', 'win32']: if env['PLATFORM'] in ['cygwin', 'win32']:
env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS')
else: else:
env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS -fPIC') env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS -fPIC')
# determine compiler version # determine compiler version
version = detect_version(env, env['CC']) version = detect_version(env, env['CC'])
if version: if version:
env['CCVERSION'] = version env['CCVERSION'] = version
env['CCDEPFLAGS'] = '-MMD -MF ${TARGET}.d'
env["NINJA_DEPFILE_PARSE_FORMAT"] = 'gcc'
def exists(env): def exists(env):
# is executable, and is a GNU compiler (or accepts '--version' at least) # is executable, and is a GNU compiler (or accepts '--version' at least)
return detect_version(env, env.Detect(env.get('CC', compilers))) return detect_version(env, env.Detect(env.get('CC', compilers)))
def detect_version(env, cc): def detect_version(env, cc):
"""Return the version of the GNU compiler, or None if it is not a GNU compil er.""" """Return the version of the GNU compiler, or None if it is not a GNU compil er."""
version = None version = None
cc = env.subst(cc) cc = env.subst(cc)
if not cc: if not cc:
return version return version
# -dumpversion was added in GCC 3.0. As long as we're supporting # -dumpversion was added in GCC 3.0. As long as we're supporting
# GCC versions older than that, we should use --version and a # GCC versions older than that, we should use --version and a
# regular expression. # regular expression.
# pipe = SCons.Action._subproc(env, SCons.Util.CLVar(cc) + ['-dumpversion'], # pipe = SCons.Action._subproc(env, SCons.Util.CLVar(cc) + ['-dumpversion'],
pipe=SCons.Action._subproc(env, SCons.Util.CLVar(cc) + ['--version'], with SCons.Action._subproc(env, SCons.Util.CLVar(cc) + ['--version'],
stdin='devnull', stdin='devnull',
stderr='devnull', stderr='devnull',
stdout=subprocess.PIPE) stdout=subprocess.PIPE) as pipe:
if pipe.wait() != 0: if pipe.wait() != 0:
return version return version
with pipe.stdout:
# -dumpversion variant: # -dumpversion variant:
# line = pipe.stdout.read().strip() # line = pipe.stdout.read().strip()
# --version variant: # --version variant:
line = SCons.Util.to_str(pipe.stdout.readline()) line = SCons.Util.to_str(pipe.stdout.readline())
# Non-GNU compiler's output (like AIX xlc's) may exceed the stdout buffe r: # Non-GNU compiler's output (like AIX xlc's) may exceed the stdout buffe r:
# So continue with reading to let the child process actually terminate. # So continue with reading to let the child process actually terminate.
# We don't need to know the rest of the data, so don't bother decoding. # We don't need to know the rest of the data, so don't bother decoding.
while pipe.stdout.readline(): while pipe.stdout.readline():
pass pass
 End of changes. 4 change blocks. 
5 lines changed or deleted 7 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)