update scons to 2.3.1

This commit is contained in:
artemp 2014-06-06 14:49:46 +01:00
parent 30a39aa376
commit 390816a396
201 changed files with 2108 additions and 845 deletions

View file

@ -3,7 +3,7 @@
This copyright and license do not apply to any other software This copyright and license do not apply to any other software
with which this software may have been included. with which this software may have been included.
Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the

View file

@ -1,4 +1,4 @@
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
SCons - a software construction tool SCons - a software construction tool

View file

@ -1,263 +0,0 @@
"""SCons.Platform.posix
Platform-specific initialization for POSIX (Linux, UNIX, etc.) systems.
There normally shouldn't be any need to import this module directly. It
will usually be imported through the generic SCons.Platform.Platform()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Platform/posix.py 2013/03/03 09:48:35 garyo"
import errno
import os
import os.path
import subprocess
import sys
import select
import SCons.Util
from SCons.Platform import TempFileMunge
exitvalmap = {
2 : 127,
13 : 126,
}
def escape(arg):
"escape shell special characters"
slash = '\\'
special = '"$()'
arg = arg.replace(slash, slash+slash)
for c in special:
arg = arg.replace(c, slash+c)
return '"' + arg + '"'
def exec_system(l, env):
stat = os.system(' '.join(l))
if stat & 0xff:
return stat | 0x80
return stat >> 8
def exec_spawnvpe(l, env):
stat = os.spawnvpe(os.P_WAIT, l[0], l, env)
# os.spawnvpe() returns the actual exit code, not the encoding
# returned by os.waitpid() or os.system().
return stat
def exec_fork(l, env):
pid = os.fork()
if not pid:
# Child process.
exitval = 127
try:
os.execvpe(l[0], l, env)
except OSError, e:
exitval = exitvalmap.get(e[0], e[0])
sys.stderr.write("scons: %s: %s\n" % (l[0], e[1]))
os._exit(exitval)
else:
# Parent process.
pid, stat = os.waitpid(pid, 0)
if stat & 0xff:
return stat | 0x80
return stat >> 8
def _get_env_command(sh, escape, cmd, args, env):
s = ' '.join(args)
if env:
l = ['env', '-'] + \
[escape(t[0])+'='+escape(t[1]) for t in env.items()] + \
[sh, '-c', escape(s)]
s = ' '.join(l)
return s
def env_spawn(sh, escape, cmd, args, env):
return exec_system([_get_env_command( sh, escape, cmd, args, env)], env)
def spawnvpe_spawn(sh, escape, cmd, args, env):
return exec_spawnvpe([sh, '-c', ' '.join(args)], env)
def fork_spawn(sh, escape, cmd, args, env):
return exec_fork([sh, '-c', ' '.join(args)], env)
def process_cmd_output(cmd_stdout, cmd_stderr, stdout, stderr):
stdout_eof = stderr_eof = 0
while not (stdout_eof and stderr_eof):
try:
(i,o,e) = select.select([cmd_stdout, cmd_stderr], [], [])
if cmd_stdout in i:
str = cmd_stdout.read()
if len(str) == 0:
stdout_eof = 1
elif stdout is not None:
stdout.write(str)
if cmd_stderr in i:
str = cmd_stderr.read()
if len(str) == 0:
#sys.__stderr__.write( "stderr_eof=1\n" )
stderr_eof = 1
else:
#sys.__stderr__.write( "str(stderr) = %s\n" % str )
stderr.write(str)
except select.error, (_errno, _strerror):
if _errno != errno.EINTR:
raise
def exec_popen3(l, env, stdout, stderr):
proc = subprocess.Popen(' '.join(l),
stdout=stdout,
stderr=stderr,
shell=True)
stat = proc.wait()
if stat & 0xff:
return stat | 0x80
return stat >> 8
def exec_piped_fork(l, env, stdout, stderr):
# spawn using fork / exec and providing a pipe for the command's
# stdout / stderr stream
if stdout != stderr:
(rFdOut, wFdOut) = os.pipe()
(rFdErr, wFdErr) = os.pipe()
else:
(rFdOut, wFdOut) = os.pipe()
rFdErr = rFdOut
wFdErr = wFdOut
# do the fork
pid = os.fork()
if not pid:
# Child process
os.close( rFdOut )
if rFdOut != rFdErr:
os.close( rFdErr )
os.dup2( wFdOut, 1 ) # is there some symbolic way to do that ?
os.dup2( wFdErr, 2 )
os.close( wFdOut )
if stdout != stderr:
os.close( wFdErr )
exitval = 127
try:
os.execvpe(l[0], l, env)
except OSError, e:
exitval = exitvalmap.get(e[0], e[0])
stderr.write("scons: %s: %s\n" % (l[0], e[1]))
os._exit(exitval)
else:
# Parent process
pid, stat = os.waitpid(pid, 0)
os.close( wFdOut )
if stdout != stderr:
os.close( wFdErr )
childOut = os.fdopen( rFdOut )
if stdout != stderr:
childErr = os.fdopen( rFdErr )
else:
childErr = childOut
process_cmd_output(childOut, childErr, stdout, stderr)
os.close( rFdOut )
if stdout != stderr:
os.close( rFdErr )
if stat & 0xff:
return stat | 0x80
return stat >> 8
def piped_env_spawn(sh, escape, cmd, args, env, stdout, stderr):
# spawn using Popen3 combined with the env command
# the command name and the command's stdout is written to stdout
# the command's stderr is written to stderr
return exec_popen3([_get_env_command(sh, escape, cmd, args, env)],
env, stdout, stderr)
def piped_fork_spawn(sh, escape, cmd, args, env, stdout, stderr):
# spawn using fork / exec and providing a pipe for the command's
# stdout / stderr stream
return exec_piped_fork([sh, '-c', ' '.join(args)],
env, stdout, stderr)
def generate(env):
# If os.spawnvpe() exists, we use it to spawn commands. Otherwise
# if the env utility exists, we use os.system() to spawn commands,
# finally we fall back on os.fork()/os.exec().
#
# os.spawnvpe() is prefered because it is the most efficient. But
# for Python versions without it, os.system() is prefered because it
# is claimed that it works better with threads (i.e. -j) and is more
# efficient than forking Python.
#
# NB: Other people on the scons-users mailing list have claimed that
# os.fork()/os.exec() works better than os.system(). There may just
# not be a default that works best for all users.
if 'spawnvpe' in os.__dict__:
spawn = spawnvpe_spawn
elif env.Detect('env'):
spawn = env_spawn
else:
spawn = fork_spawn
if env.Detect('env'):
pspawn = piped_env_spawn
else:
pspawn = piped_fork_spawn
if 'ENV' not in env:
env['ENV'] = {}
env['ENV']['PATH'] = '/usr/local/bin:/opt/bin:/bin:/usr/bin'
env['OBJPREFIX'] = ''
env['OBJSUFFIX'] = '.o'
env['SHOBJPREFIX'] = '$OBJPREFIX'
env['SHOBJSUFFIX'] = '$OBJSUFFIX'
env['PROGPREFIX'] = ''
env['PROGSUFFIX'] = ''
env['LIBPREFIX'] = 'lib'
env['LIBSUFFIX'] = '.a'
env['SHLIBPREFIX'] = '$LIBPREFIX'
env['SHLIBSUFFIX'] = '.so'
env['LIBPREFIXES'] = [ '$LIBPREFIX' ]
env['LIBSUFFIXES'] = [ '$LIBSUFFIX', '$SHLIBSUFFIX' ]
env['PSPAWN'] = pspawn
env['SPAWN'] = spawn
env['SHELL'] = 'sh'
env['ESCAPE'] = escape
env['TEMPFILE'] = TempFileMunge
env['TEMPFILEPREFIX'] = '@'
#Based on LINUX: ARG_MAX=ARG_MAX=131072 - 3000 for environment expansion
#Note: specific platforms might rise or lower this value
env['MAXLINELENGTH'] = 128072
# This platform supports RPATH specifications.
env['__RPATH'] = '$_RPATH'
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:

View file

@ -76,7 +76,7 @@ way for wrapping up the functions.
""" """
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -97,7 +97,7 @@ way for wrapping up the functions.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Action.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Action.py 2014/03/02 14:18:15 garyo"
import SCons.compat import SCons.compat
@ -109,6 +109,7 @@ import re
import sys import sys
import subprocess import subprocess
import SCons.Debug
from SCons.Debug import logInstanceCreation from SCons.Debug import logInstanceCreation
import SCons.Errors import SCons.Errors
import SCons.Executor import SCons.Executor
@ -439,7 +440,8 @@ class ActionBase(object):
vl = self.get_varlist(target, source, env) vl = self.get_varlist(target, source, env)
if is_String(vl): vl = (vl,) if is_String(vl): vl = (vl,)
for v in vl: for v in vl:
result.append(env.subst('${'+v+'}')) # do the subst this way to ignore $(...$) parts:
result.append(env.subst_target_source('${'+v+'}', SCons.Subst.SUBST_SIG, target, source))
return ''.join(result) return ''.join(result)
def __add__(self, other): def __add__(self, other):
@ -698,7 +700,7 @@ class CommandAction(_ActionAction):
# factory above does). cmd will be passed to # factory above does). cmd will be passed to
# Environment.subst_list() for substituting environment # Environment.subst_list() for substituting environment
# variables. # variables.
if __debug__: logInstanceCreation(self, 'Action.CommandAction') if SCons.Debug.track_instances: logInstanceCreation(self, 'Action.CommandAction')
_ActionAction.__init__(self, **kw) _ActionAction.__init__(self, **kw)
if is_List(cmd): if is_List(cmd):
@ -855,7 +857,7 @@ class CommandAction(_ActionAction):
class CommandGeneratorAction(ActionBase): class CommandGeneratorAction(ActionBase):
"""Class for command-generator actions.""" """Class for command-generator actions."""
def __init__(self, generator, kw): def __init__(self, generator, kw):
if __debug__: logInstanceCreation(self, 'Action.CommandGeneratorAction') if SCons.Debug.track_instances: logInstanceCreation(self, 'Action.CommandGeneratorAction')
self.generator = generator self.generator = generator
self.gen_kw = kw self.gen_kw = kw
self.varlist = kw.get('varlist', ()) self.varlist = kw.get('varlist', ())
@ -944,7 +946,7 @@ class CommandGeneratorAction(ActionBase):
class LazyAction(CommandGeneratorAction, CommandAction): class LazyAction(CommandGeneratorAction, CommandAction):
def __init__(self, var, kw): def __init__(self, var, kw):
if __debug__: logInstanceCreation(self, 'Action.LazyAction') if SCons.Debug.track_instances: logInstanceCreation(self, 'Action.LazyAction')
#FUTURE CommandAction.__init__(self, '${'+var+'}', **kw) #FUTURE CommandAction.__init__(self, '${'+var+'}', **kw)
CommandAction.__init__(self, '${'+var+'}', **kw) CommandAction.__init__(self, '${'+var+'}', **kw)
self.var = SCons.Util.to_String(var) self.var = SCons.Util.to_String(var)
@ -986,7 +988,7 @@ class FunctionAction(_ActionAction):
"""Class for Python function actions.""" """Class for Python function actions."""
def __init__(self, execfunction, kw): def __init__(self, execfunction, kw):
if __debug__: logInstanceCreation(self, 'Action.FunctionAction') if SCons.Debug.track_instances: logInstanceCreation(self, 'Action.FunctionAction')
self.execfunction = execfunction self.execfunction = execfunction
try: try:
@ -1108,7 +1110,7 @@ class FunctionAction(_ActionAction):
class ListAction(ActionBase): class ListAction(ActionBase):
"""Class for lists of other actions.""" """Class for lists of other actions."""
def __init__(self, actionlist): def __init__(self, actionlist):
if __debug__: logInstanceCreation(self, 'Action.ListAction') if SCons.Debug.track_instances: logInstanceCreation(self, 'Action.ListAction')
def list_of_actions(x): def list_of_actions(x):
if isinstance(x, ActionBase): if isinstance(x, ActionBase):
return x return x

View file

@ -76,7 +76,7 @@ There are the following methods for internal use within this module:
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -97,11 +97,12 @@ There are the following methods for internal use within this module:
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Builder.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Builder.py 2014/03/02 14:18:15 garyo"
import collections import collections
import SCons.Action import SCons.Action
import SCons.Debug
from SCons.Debug import logInstanceCreation from SCons.Debug import logInstanceCreation
from SCons.Errors import InternalError, UserError from SCons.Errors import InternalError, UserError
import SCons.Executor import SCons.Executor
@ -225,7 +226,7 @@ class OverrideWarner(collections.UserDict):
""" """
def __init__(self, dict): def __init__(self, dict):
collections.UserDict.__init__(self, dict) collections.UserDict.__init__(self, dict)
if __debug__: logInstanceCreation(self, 'Builder.OverrideWarner') if SCons.Debug.track_instances: logInstanceCreation(self, 'Builder.OverrideWarner')
self.already_warned = None self.already_warned = None
def warn(self): def warn(self):
if self.already_warned: if self.already_warned:
@ -376,7 +377,7 @@ class BuilderBase(object):
src_builder = None, src_builder = None,
ensure_suffix = False, ensure_suffix = False,
**overrides): **overrides):
if __debug__: logInstanceCreation(self, 'Builder.BuilderBase') if SCons.Debug.track_instances: logInstanceCreation(self, 'Builder.BuilderBase')
self._memo = {} self._memo = {}
self.action = action self.action = action
self.multi = multi self.multi = multi
@ -847,7 +848,7 @@ class CompositeBuilder(SCons.Util.Proxy):
""" """
def __init__(self, builder, cmdgen): def __init__(self, builder, cmdgen):
if __debug__: logInstanceCreation(self, 'Builder.CompositeBuilder') if SCons.Debug.track_instances: logInstanceCreation(self, 'Builder.CompositeBuilder')
SCons.Util.Proxy.__init__(self, builder) SCons.Util.Proxy.__init__(self, builder)
# cmdgen should always be an instance of DictCmdGenerator. # cmdgen should always be an instance of DictCmdGenerator.

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/CacheDir.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/CacheDir.py 2014/03/02 14:18:15 garyo"
__doc__ = """ __doc__ = """
CacheDir support CacheDir support
@ -37,6 +37,7 @@ cache_enabled = True
cache_debug = False cache_debug = False
cache_force = False cache_force = False
cache_show = False cache_show = False
cache_readonly = False
def CacheRetrieveFunc(target, source, env): def CacheRetrieveFunc(target, source, env):
t = target[0] t = target[0]
@ -70,6 +71,8 @@ CacheRetrieve = SCons.Action.Action(CacheRetrieveFunc, CacheRetrieveString)
CacheRetrieveSilent = SCons.Action.Action(CacheRetrieveFunc, None) CacheRetrieveSilent = SCons.Action.Action(CacheRetrieveFunc, None)
def CachePushFunc(target, source, env): def CachePushFunc(target, source, env):
if cache_readonly: return
t = target[0] t = target[0]
if t.nocache: if t.nocache:
return return
@ -150,6 +153,9 @@ class CacheDir(object):
def is_enabled(self): def is_enabled(self):
return (cache_enabled and not self.path is None) return (cache_enabled and not self.path is None)
def is_readonly(self):
return cache_readonly
def cachepath(self, node): def cachepath(self, node):
""" """
""" """
@ -201,7 +207,7 @@ class CacheDir(object):
return False return False
def push(self, node): def push(self, node):
if not self.is_enabled(): if self.is_readonly() or not self.is_enabled():
return return
return CachePush(node, [], node.get_build_env()) return CachePush(node, [], node.get_build_env())

View file

@ -156,7 +156,7 @@ def CheckCC(context):
too, so that it can test against non working flags. too, so that it can test against non working flags.
""" """
context.Display("Checking whether the C compiler works") context.Display("Checking whether the C compiler works... ")
text = """ text = """
int main() int main()
{ {
@ -176,7 +176,7 @@ def CheckSHCC(context):
too, so that it can test against non working flags. too, so that it can test against non working flags.
""" """
context.Display("Checking whether the (shared) C compiler works") context.Display("Checking whether the (shared) C compiler works... ")
text = """ text = """
int foo() int foo()
{ {
@ -196,7 +196,7 @@ def CheckCXX(context):
too, so that it can test against non working flags. too, so that it can test against non working flags.
""" """
context.Display("Checking whether the C++ compiler works") context.Display("Checking whether the C++ compiler works... ")
text = """ text = """
int main() int main()
{ {
@ -216,7 +216,7 @@ def CheckSHCXX(context):
too, so that it can test against non working flags. too, so that it can test against non working flags.
""" """
context.Display("Checking whether the (shared) C++ compiler works") context.Display("Checking whether the (shared) C++ compiler works... ")
text = """ text = """
int main() int main()
{ {

View file

@ -6,7 +6,7 @@ needed by most users.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -28,13 +28,17 @@ needed by most users.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Debug.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Debug.py 2014/03/02 14:18:15 garyo"
import os import os
import sys import sys
import time import time
import weakref import weakref
# Global variable that gets set to 'True' by the Main script,
# when the creation of class instances should get tracked.
track_instances = False
# List of currently tracked classes
tracked_classes = {} tracked_classes = {}
def logInstanceCreation(instance, name=None): def logInstanceCreation(instance, name=None):
@ -109,14 +113,15 @@ else:
return res[4] return res[4]
# returns caller's stack # returns caller's stack
def caller_stack(*backlist): def caller_stack():
import traceback import traceback
if not backlist: tb = traceback.extract_stack()
backlist = [0] # strip itself and the caller from the output
tb = tb[:-2]
result = [] result = []
for back in backlist: for back in tb:
tb = traceback.extract_stack(limit=3+back) # (filename, line number, function name, text)
key = tb[0][:3] key = back[:3]
result.append('%s:%d(%s)' % func_shorten(key)) result.append('%s:%d(%s)' % func_shorten(key))
return result return result

View file

@ -10,7 +10,7 @@ from distutils.msvccompiler.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -33,7 +33,7 @@ from distutils.msvccompiler.
# #
from __future__ import division from __future__ import division
__revision__ = "src/engine/SCons/Defaults.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Defaults.py 2014/03/02 14:18:15 garyo"
import os import os

View file

@ -10,7 +10,7 @@ Environment
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -31,7 +31,7 @@ Environment
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Environment.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Environment.py 2014/03/02 14:18:15 garyo"
import copy import copy
@ -43,6 +43,7 @@ from collections import UserDict
import SCons.Action import SCons.Action
import SCons.Builder import SCons.Builder
import SCons.Debug
from SCons.Debug import logInstanceCreation from SCons.Debug import logInstanceCreation
import SCons.Defaults import SCons.Defaults
import SCons.Errors import SCons.Errors
@ -370,7 +371,7 @@ class SubstitutionEnvironment(object):
def __init__(self, **kw): def __init__(self, **kw):
"""Initialization of an underlying SubstitutionEnvironment class. """Initialization of an underlying SubstitutionEnvironment class.
""" """
if __debug__: logInstanceCreation(self, 'Environment.SubstitutionEnvironment') if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.SubstitutionEnvironment')
self.fs = SCons.Node.FS.get_default_fs() self.fs = SCons.Node.FS.get_default_fs()
self.ans = SCons.Node.Alias.default_ans self.ans = SCons.Node.Alias.default_ans
self.lookup_list = SCons.Node.arg2nodes_lookups self.lookup_list = SCons.Node.arg2nodes_lookups
@ -704,7 +705,7 @@ class SubstitutionEnvironment(object):
# -symbolic (linker global binding) # -symbolic (linker global binding)
# -R dir (deprecated linker rpath) # -R dir (deprecated linker rpath)
# IBM compilers may also accept -qframeworkdir=foo # IBM compilers may also accept -qframeworkdir=foo
params = shlex.split(arg) params = shlex.split(arg)
append_next_arg_to = None # for multi-word args append_next_arg_to = None # for multi-word args
for arg in params: for arg in params:
@ -794,7 +795,7 @@ class SubstitutionEnvironment(object):
append_next_arg_to = arg append_next_arg_to = arg
else: else:
dict['CCFLAGS'].append(arg) dict['CCFLAGS'].append(arg)
for arg in flags: for arg in flags:
do_parse(arg) do_parse(arg)
return dict return dict
@ -858,7 +859,7 @@ class SubstitutionEnvironment(object):
# def MergeShellPaths(self, args, prepend=1): # def MergeShellPaths(self, args, prepend=1):
# """ # """
# Merge the dict in args into the shell environment in env['ENV']. # Merge the dict in args into the shell environment in env['ENV'].
# Shell path elements are appended or prepended according to prepend. # Shell path elements are appended or prepended according to prepend.
# Uses Pre/AppendENVPath, so it always appends or prepends uniquely. # Uses Pre/AppendENVPath, so it always appends or prepends uniquely.
@ -931,7 +932,7 @@ class Base(SubstitutionEnvironment):
initialize things in a very specific order that doesn't work initialize things in a very specific order that doesn't work
with the much simpler base class initialization. with the much simpler base class initialization.
""" """
if __debug__: logInstanceCreation(self, 'Environment.Base') if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.Base')
self._memo = {} self._memo = {}
self.fs = SCons.Node.FS.get_default_fs() self.fs = SCons.Node.FS.get_default_fs()
self.ans = SCons.Node.Alias.default_ans self.ans = SCons.Node.Alias.default_ans
@ -961,14 +962,14 @@ class Base(SubstitutionEnvironment):
platform = SCons.Platform.Platform(platform) platform = SCons.Platform.Platform(platform)
self._dict['PLATFORM'] = str(platform) self._dict['PLATFORM'] = str(platform)
platform(self) platform(self)
self._dict['HOST_OS'] = self._dict.get('HOST_OS',None) self._dict['HOST_OS'] = self._dict.get('HOST_OS',None)
self._dict['HOST_ARCH'] = self._dict.get('HOST_ARCH',None) self._dict['HOST_ARCH'] = self._dict.get('HOST_ARCH',None)
# Now set defaults for TARGET_{OS|ARCH} # Now set defaults for TARGET_{OS|ARCH}
self._dict['TARGET_OS'] = self._dict.get('HOST_OS',None) self._dict['TARGET_OS'] = self._dict.get('TARGET_OS',None)
self._dict['TARGET_ARCH'] = self._dict.get('HOST_ARCH',None) self._dict['TARGET_ARCH'] = self._dict.get('TARGET_ARCH',None)
# Apply the passed-in and customizable variables to the # Apply the passed-in and customizable variables to the
# environment before calling the tools, because they may use # environment before calling the tools, because they may use
@ -1157,7 +1158,7 @@ class Base(SubstitutionEnvironment):
# "continue" statements whenever we finish processing an item, # "continue" statements whenever we finish processing an item,
# but Python 1.5.2 apparently doesn't let you use "continue" # but Python 1.5.2 apparently doesn't let you use "continue"
# within try:-except: blocks, so we have to nest our code. # within try:-except: blocks, so we have to nest our code.
try: try:
if key == 'CPPDEFINES' and SCons.Util.is_String(self._dict[key]): if key == 'CPPDEFINES' and SCons.Util.is_String(self._dict[key]):
self._dict[key] = [self._dict[key]] self._dict[key] = [self._dict[key]]
orig = self._dict[key] orig = self._dict[key]
@ -1208,7 +1209,7 @@ class Base(SubstitutionEnvironment):
orig = orig.items() orig = orig.items()
orig += val orig += val
self._dict[key] = orig self._dict[key] = orig
else: else:
for v in val: for v in val:
orig[v] = None orig[v] = None
else: else:
@ -1231,7 +1232,7 @@ class Base(SubstitutionEnvironment):
path = str(self.fs.Dir(path)) path = str(self.fs.Dir(path))
return path return path
def AppendENVPath(self, name, newpath, envname = 'ENV', def AppendENVPath(self, name, newpath, envname = 'ENV',
sep = os.pathsep, delete_existing=1): sep = os.pathsep, delete_existing=1):
"""Append path elements to the path 'name' in the 'ENV' """Append path elements to the path 'name' in the 'ENV'
dictionary for this environment. Will only add any particular dictionary for this environment. Will only add any particular
@ -1289,7 +1290,7 @@ class Base(SubstitutionEnvironment):
dk = dk.items() dk = dk.items()
elif SCons.Util.is_String(dk): elif SCons.Util.is_String(dk):
dk = [(dk,)] dk = [(dk,)]
else: else:
tmp = [] tmp = []
for i in dk: for i in dk:
if SCons.Util.is_List(i): if SCons.Util.is_List(i):
@ -1334,7 +1335,7 @@ class Base(SubstitutionEnvironment):
dk = filter(lambda x, val=val: x not in val, dk) dk = filter(lambda x, val=val: x not in val, dk)
self._dict[key] = dk + val self._dict[key] = dk + val
else: else:
dk = [x for x in dk if x not in val] dk = [x for x in dk if x not in val]
self._dict[key] = dk + val self._dict[key] = dk + val
else: else:
# By elimination, val is not a list. Since dk is a # By elimination, val is not a list. Since dk is a
@ -1381,7 +1382,7 @@ class Base(SubstitutionEnvironment):
builders = self._dict['BUILDERS'] builders = self._dict['BUILDERS']
except KeyError: except KeyError:
pass pass
clone = copy.copy(self) clone = copy.copy(self)
# BUILDERS is not safe to do a simple copy # BUILDERS is not safe to do a simple copy
clone._dict = semi_deepcopy_dict(self._dict, ['BUILDERS']) clone._dict = semi_deepcopy_dict(self._dict, ['BUILDERS'])
@ -1409,12 +1410,12 @@ class Base(SubstitutionEnvironment):
apply_tools(clone, tools, toolpath) apply_tools(clone, tools, toolpath)
# apply them again in case the tools overwrote them # apply them again in case the tools overwrote them
clone.Replace(**new) clone.Replace(**new)
# Finally, apply any flags to be merged in # Finally, apply any flags to be merged in
if parse_flags: clone.MergeFlags(parse_flags) if parse_flags: clone.MergeFlags(parse_flags)
if __debug__: logInstanceCreation(self, 'Environment.EnvironmentClone') if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.EnvironmentClone')
return clone return clone
def Copy(self, *args, **kw): def Copy(self, *args, **kw):
@ -2086,6 +2087,14 @@ class Base(SubstitutionEnvironment):
t.set_precious() t.set_precious()
return tlist return tlist
def Pseudo(self, *targets):
tlist = []
for t in targets:
tlist.extend(self.arg2nodes(t, self.fs.Entry))
for t in tlist:
t.set_pseudo()
return tlist
def Repository(self, *dirs, **kw): def Repository(self, *dirs, **kw):
dirs = self.arg2nodes(list(dirs), self.fs.Dir) dirs = self.arg2nodes(list(dirs), self.fs.Dir)
self.fs.Repository(*dirs, **kw) self.fs.Repository(*dirs, **kw)
@ -2270,7 +2279,7 @@ class OverrideEnvironment(Base):
""" """
def __init__(self, subject, overrides={}): def __init__(self, subject, overrides={}):
if __debug__: logInstanceCreation(self, 'Environment.OverrideEnvironment') if SCons.Debug.track_instances: logInstanceCreation(self, 'Environment.OverrideEnvironment')
self.__dict__['__subject'] = subject self.__dict__['__subject'] = subject
self.__dict__['overrides'] = overrides self.__dict__['overrides'] = overrides

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -28,7 +28,7 @@ and user errors in SCons.
""" """
__revision__ = "src/engine/SCons/Errors.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Errors.py 2014/03/02 14:18:15 garyo"
import SCons.Util import SCons.Util

View file

@ -6,7 +6,7 @@ Nodes.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -27,10 +27,11 @@ Nodes.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Executor.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Executor.py 2014/03/02 14:18:15 garyo"
import collections import collections
import SCons.Debug
from SCons.Debug import logInstanceCreation from SCons.Debug import logInstanceCreation
import SCons.Errors import SCons.Errors
import SCons.Memoize import SCons.Memoize
@ -123,7 +124,7 @@ class Executor(object):
def __init__(self, action, env=None, overridelist=[{}], def __init__(self, action, env=None, overridelist=[{}],
targets=[], sources=[], builder_kw={}): targets=[], sources=[], builder_kw={}):
if __debug__: logInstanceCreation(self, 'Executor.Executor') if SCons.Debug.track_instances: logInstanceCreation(self, 'Executor.Executor')
self.set_action_list(action) self.set_action_list(action)
self.pre_actions = [] self.pre_actions = []
self.post_actions = [] self.post_actions = []
@ -229,6 +230,8 @@ class Executor(object):
self.action_list = action self.action_list = action
def get_action_list(self): def get_action_list(self):
if self.action_list is None:
return []
return self.pre_actions + self.action_list + self.post_actions return self.pre_actions + self.action_list + self.post_actions
def get_all_targets(self): def get_all_targets(self):
@ -267,7 +270,8 @@ class Executor(object):
""" """
result = SCons.Util.UniqueList([]) result = SCons.Util.UniqueList([])
for target in self.get_all_targets(): for target in self.get_all_targets():
result.extend(target.prerequisites) if target.prerequisites is not None:
result.extend(target.prerequisites)
return result return result
def get_action_side_effects(self): def get_action_side_effects(self):
@ -570,12 +574,12 @@ class Null(object):
"""A null Executor, with a null build Environment, that does """A null Executor, with a null build Environment, that does
nothing when the rest of the methods call it. nothing when the rest of the methods call it.
This might be able to disapper when we refactor things to This might be able to disappear when we refactor things to
disassociate Builders from Nodes entirely, so we're not disassociate Builders from Nodes entirely, so we're not
going to worry about unit tests for this--at least for now. going to worry about unit tests for this--at least for now.
""" """
def __init__(self, *args, **kw): def __init__(self, *args, **kw):
if __debug__: logInstanceCreation(self, 'Executor.Null') if SCons.Debug.track_instances: logInstanceCreation(self, 'Executor.Null')
self.batches = [Batch(kw['targets'][:], [])] self.batches = [Batch(kw['targets'][:], [])]
def get_build_env(self): def get_build_env(self):
return get_NullEnvironment() return get_NullEnvironment()
@ -625,7 +629,6 @@ class Null(object):
self._morph() self._morph()
self.set_action_list(action) self.set_action_list(action)
# Local Variables: # Local Variables:
# tab-width:4 # tab-width:4
# indent-tabs-mode:nil # indent-tabs-mode:nil

View file

@ -7,7 +7,7 @@ stop, and wait on jobs.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -29,7 +29,7 @@ stop, and wait on jobs.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Job.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Job.py 2014/03/02 14:18:15 garyo"
import SCons.compat import SCons.compat

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Memoize.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Memoize.py 2014/03/02 14:18:15 garyo"
__doc__ = """Memoizer __doc__ = """Memoizer

View file

@ -8,7 +8,7 @@ This creates a hash of global Aliases (dummy targets).
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ This creates a hash of global Aliases (dummy targets).
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Node/Alias.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Node/Alias.py 2014/03/02 14:18:15 garyo"
import collections import collections

View file

@ -11,7 +11,7 @@ that can be used by scripts or modules looking for the canonical default.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -32,7 +32,7 @@ that can be used by scripts or modules looking for the canonical default.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Node/FS.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Node/FS.py 2014/03/02 14:18:15 garyo"
import fnmatch import fnmatch
import os import os
@ -44,6 +44,7 @@ import time
import codecs import codecs
import SCons.Action import SCons.Action
import SCons.Debug
from SCons.Debug import logInstanceCreation from SCons.Debug import logInstanceCreation
import SCons.Errors import SCons.Errors
import SCons.Memoize import SCons.Memoize
@ -581,7 +582,7 @@ class Base(SCons.Node.Node):
our relative and absolute paths, identify our parent our relative and absolute paths, identify our parent
directory, and indicate that this node should use directory, and indicate that this node should use
signatures.""" signatures."""
if __debug__: logInstanceCreation(self, 'Node.FS.Base') if SCons.Debug.track_instances: logInstanceCreation(self, 'Node.FS.Base')
SCons.Node.Node.__init__(self) SCons.Node.Node.__init__(self)
# Filenames and paths are probably reused and are intern'ed to # Filenames and paths are probably reused and are intern'ed to
@ -1111,7 +1112,7 @@ class FS(LocalFS):
The path argument must be a valid absolute path. The path argument must be a valid absolute path.
""" """
if __debug__: logInstanceCreation(self, 'Node.FS') if SCons.Debug.track_instances: logInstanceCreation(self, 'Node.FS')
self._memo = {} self._memo = {}
@ -1445,7 +1446,7 @@ class Dir(Base):
BuildInfo = DirBuildInfo BuildInfo = DirBuildInfo
def __init__(self, name, directory, fs): def __init__(self, name, directory, fs):
if __debug__: logInstanceCreation(self, 'Node.FS.Dir') if SCons.Debug.track_instances: logInstanceCreation(self, 'Node.FS.Dir')
Base.__init__(self, name, directory, fs) Base.__init__(self, name, directory, fs)
self._morph() self._morph()
@ -1841,7 +1842,7 @@ class Dir(Base):
for entry in map(_my_normcase, entries): for entry in map(_my_normcase, entries):
d[entry] = True d[entry] = True
self.on_disk_entries = d self.on_disk_entries = d
if sys.platform == 'win32': if sys.platform == 'win32' or sys.platform == 'cygwin':
name = _my_normcase(name) name = _my_normcase(name)
result = d.get(name) result = d.get(name)
if result is None: if result is None:
@ -2113,7 +2114,7 @@ class RootDir(Dir):
this directory. this directory.
""" """
def __init__(self, drive, fs): def __init__(self, drive, fs):
if __debug__: logInstanceCreation(self, 'Node.FS.RootDir') if SCons.Debug.track_instances: logInstanceCreation(self, 'Node.FS.RootDir')
# We're going to be our own parent directory (".." entry and .dir # We're going to be our own parent directory (".." entry and .dir
# attribute) so we have to set up some values so Base.__init__() # attribute) so we have to set up some values so Base.__init__()
# won't gag won't it calls some of our methods. # won't gag won't it calls some of our methods.
@ -2361,7 +2362,7 @@ class File(Base):
"Directory %s found where file expected.") "Directory %s found where file expected.")
def __init__(self, name, directory, fs): def __init__(self, name, directory, fs):
if __debug__: logInstanceCreation(self, 'Node.FS.File') if SCons.Debug.track_instances: logInstanceCreation(self, 'Node.FS.File')
Base.__init__(self, name, directory, fs) Base.__init__(self, name, directory, fs)
self._morph() self._morph()
@ -2397,6 +2398,8 @@ class File(Base):
self.scanner_paths = {} self.scanner_paths = {}
if not hasattr(self, '_local'): if not hasattr(self, '_local'):
self._local = 0 self._local = 0
if not hasattr(self, 'released_target_info'):
self.released_target_info = False
# If there was already a Builder set on this entry, then # If there was already a Builder set on this entry, then
# we need to make sure we call the target-decider function, # we need to make sure we call the target-decider function,
@ -2724,7 +2727,7 @@ class File(Base):
return self.get_build_env().get_CacheDir().retrieve(self) return self.get_build_env().get_CacheDir().retrieve(self)
def visited(self): def visited(self):
if self.exists(): if self.exists() and self.executor is not None:
self.get_build_env().get_CacheDir().push_if_forced(self) self.get_build_env().get_CacheDir().push_if_forced(self)
ninfo = self.get_ninfo() ninfo = self.get_ninfo()
@ -2746,6 +2749,58 @@ class File(Base):
self.store_info() self.store_info()
def release_target_info(self):
"""Called just after this node has been marked
up-to-date or was built completely.
This is where we try to release as many target node infos
as possible for clean builds and update runs, in order
to minimize the overall memory consumption.
We'd like to remove a lot more attributes like self.sources
and self.sources_set, but they might get used
in a next build step. For example, during configuration
the source files for a built *.o file are used to figure out
which linker to use for the resulting Program (gcc vs. g++)!
That's why we check for the 'keep_targetinfo' attribute,
config Nodes and the Interactive mode just don't allow
an early release of most variables.
In the same manner, we can't simply remove the self.attributes
here. The smart linking relies on the shared flag, and some
parts of the java Tool use it to transport information
about nodes...
@see: built() and Node.release_target_info()
"""
if (self.released_target_info or SCons.Node.interactive):
return
if not hasattr(self.attributes, 'keep_targetinfo'):
# Cache some required values, before releasing
# stuff like env, executor and builder...
self.changed(allowcache=True)
self.get_contents_sig()
self.get_build_env()
# Now purge unneeded stuff to free memory...
self.executor = None
self._memo.pop('rfile', None)
self.prerequisites = None
# Cleanup lists, but only if they're empty
if not len(self.ignore_set):
self.ignore_set = None
if not len(self.implicit_set):
self.implicit_set = None
if not len(self.depends_set):
self.depends_set = None
if not len(self.ignore):
self.ignore = None
if not len(self.depends):
self.depends = None
# Mark this node as done, we only have to release
# the memory once...
self.released_target_info = True
def find_src_builder(self): def find_src_builder(self):
if self.rexists(): if self.rexists():
return None return None
@ -2956,6 +3011,52 @@ class File(Base):
SCons.Node.Node.builder_set(self, builder) SCons.Node.Node.builder_set(self, builder)
self.changed_since_last_build = self.decide_target self.changed_since_last_build = self.decide_target
def built(self):
"""Called just after this File node is successfully built.
Just like for 'release_target_info' we try to release
some more target node attributes in order to minimize the
overall memory consumption.
@see: release_target_info
"""
SCons.Node.Node.built(self)
if (not SCons.Node.interactive and
not hasattr(self.attributes, 'keep_targetinfo')):
# Ensure that the build infos get computed and cached...
self.store_info()
# ... then release some more variables.
self._specific_sources = False
self.labspath = None
self._save_str()
self.cwd = None
self.scanner_paths = None
def changed(self, node=None, allowcache=False):
"""
Returns if the node is up-to-date with respect to the BuildInfo
stored last time it was built.
For File nodes this is basically a wrapper around Node.changed(),
but we allow the return value to get cached after the reference
to the Executor got released in release_target_info().
@see: Node.changed()
"""
if node is None:
try:
return self._memo['changed']
except KeyError:
pass
has_changed = SCons.Node.Node.changed(self, node)
if allowcache:
self._memo['changed'] = has_changed
return has_changed
def changed_content(self, target, prev_ni): def changed_content(self, target, prev_ni):
cur_csig = self.get_csig() cur_csig = self.get_csig()
try: try:
@ -3089,25 +3190,50 @@ class File(Base):
self.cachedir_csig = self.get_csig() self.cachedir_csig = self.get_csig()
return self.cachedir_csig return self.cachedir_csig
def get_contents_sig(self):
"""
A helper method for get_cachedir_bsig.
It computes and returns the signature for this
node's contents.
"""
try:
return self.contentsig
except AttributeError:
pass
executor = self.get_executor()
result = self.contentsig = SCons.Util.MD5signature(executor.get_contents())
return result
def get_cachedir_bsig(self): def get_cachedir_bsig(self):
"""
Return the signature for a cached file, including
its children.
It adds the path of the cached file to the cache signature,
because multiple targets built by the same action will all
have the same build signature, and we have to differentiate
them somehow.
"""
try: try:
return self.cachesig return self.cachesig
except AttributeError: except AttributeError:
pass pass
# Add the path to the cache signature, because multiple # Collect signatures for all children
# targets built by the same action will all have the same
# build signature, and we have to differentiate them somehow.
children = self.children() children = self.children()
executor = self.get_executor()
# sigs = [n.get_cachedir_csig() for n in children]
sigs = [n.get_cachedir_csig() for n in children] sigs = [n.get_cachedir_csig() for n in children]
sigs.append(SCons.Util.MD5signature(executor.get_contents())) # Append this node's signature...
sigs.append(self.get_contents_sig())
# ...and it's path
sigs.append(self.path) sigs.append(self.path)
# Merge this all into a single signature
result = self.cachesig = SCons.Util.MD5collect(sigs) result = self.cachesig = SCons.Util.MD5collect(sigs)
return result return result
default_fs = None default_fs = None
def get_default_fs(): def get_default_fs():

View file

@ -5,7 +5,7 @@ Python nodes.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -27,7 +27,7 @@ Python nodes.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Node/Python.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Node/Python.py 2014/03/02 14:18:15 garyo"
import SCons.Node import SCons.Node

View file

@ -20,7 +20,7 @@ be able to depend on any other type of "thing."
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -41,12 +41,13 @@ be able to depend on any other type of "thing."
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Node/__init__.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Node/__init__.py 2014/03/02 14:18:15 garyo"
import collections import collections
import copy import copy
from itertools import chain from itertools import chain
import SCons.Debug
from SCons.Debug import logInstanceCreation from SCons.Debug import logInstanceCreation
import SCons.Executor import SCons.Executor
import SCons.Memoize import SCons.Memoize
@ -57,6 +58,10 @@ from SCons.Debug import Trace
def classname(obj): def classname(obj):
return str(obj.__class__).split('.')[-1] return str(obj.__class__).split('.')[-1]
# Set to false if we're doing a dry run. There's more than one of these
# little treats
do_store_info = True
# Node states # Node states
# #
# These are in "priority" order, so that the maximum value for any # These are in "priority" order, so that the maximum value for any
@ -95,6 +100,11 @@ def do_nothing(node): pass
Annotate = do_nothing Annotate = do_nothing
# Gets set to 'True' if we're running in interactive mode. Is
# currently used to release parts of a target's info during
# clean builds and update runs (see release_target_info).
interactive = False
# Classes for signature info for Nodes. # Classes for signature info for Nodes.
class NodeInfoBase(object): class NodeInfoBase(object):
@ -183,7 +193,7 @@ class Node(object):
pass pass
def __init__(self): def __init__(self):
if __debug__: logInstanceCreation(self, 'Node.Node') if SCons.Debug.track_instances: logInstanceCreation(self, 'Node.Node')
# Note that we no longer explicitly initialize a self.builder # Note that we no longer explicitly initialize a self.builder
# attribute to None here. That's because the self.builder # attribute to None here. That's because the self.builder
# attribute may be created on-the-fly later by a subclass (the # attribute may be created on-the-fly later by a subclass (the
@ -204,7 +214,7 @@ class Node(object):
self.depends_set = set() self.depends_set = set()
self.ignore = [] # dependencies to ignore self.ignore = [] # dependencies to ignore
self.ignore_set = set() self.ignore_set = set()
self.prerequisites = SCons.Util.UniqueList() self.prerequisites = None
self.implicit = None # implicit (scanned) dependencies (None means not scanned yet) self.implicit = None # implicit (scanned) dependencies (None means not scanned yet)
self.waiting_parents = set() self.waiting_parents = set()
self.waiting_s_e = set() self.waiting_s_e = set()
@ -214,6 +224,7 @@ class Node(object):
self.env = None self.env = None
self.state = no_state self.state = no_state
self.precious = None self.precious = None
self.pseudo = False
self.noclean = 0 self.noclean = 0
self.nocache = 0 self.nocache = 0
self.cached = 0 # is this node pulled from cache? self.cached = 0 # is this node pulled from cache?
@ -286,7 +297,8 @@ class Node(object):
except AttributeError: except AttributeError:
pass pass
else: else:
executor.cleanup() if executor is not None:
executor.cleanup()
def reset_executor(self): def reset_executor(self):
"Remove cached executor; forces recompute when needed." "Remove cached executor; forces recompute when needed."
@ -346,10 +358,11 @@ class Node(object):
methods should call this base class method to get the child methods should call this base class method to get the child
check and the BuildInfo structure. check and the BuildInfo structure.
""" """
for d in self.depends: if self.depends is not None:
if d.missing(): for d in self.depends:
msg = "Explicit dependency `%s' not found, needed by target `%s'." if d.missing():
raise SCons.Errors.StopError(msg % (d, self)) msg = "Explicit dependency `%s' not found, needed by target `%s'."
raise SCons.Errors.StopError(msg % (d, self))
if self.implicit is not None: if self.implicit is not None:
for i in self.implicit: for i in self.implicit:
if i.missing(): if i.missing():
@ -385,6 +398,13 @@ class Node(object):
self.clear() self.clear()
if self.pseudo:
if self.exists():
raise SCons.Errors.UserError("Pseudo target " + str(self) + " must not exist")
else:
if not self.exists() and do_store_info:
SCons.Warnings.warn(SCons.Warnings.TargetNotBuiltWarning,
"Cannot find target " + str(self) + " after building")
self.ninfo.update(self) self.ninfo.update(self)
def visited(self): def visited(self):
@ -400,6 +420,23 @@ class Node(object):
self.ninfo.update(self) self.ninfo.update(self)
self.store_info() self.store_info()
def release_target_info(self):
"""Called just after this node has been marked
up-to-date or was built completely.
This is where we try to release as many target node infos
as possible for clean builds and update runs, in order
to minimize the overall memory consumption.
By purging attributes that aren't needed any longer after
a Node (=File) got built, we don't have to care that much how
many KBytes a Node actually requires...as long as we free
the memory shortly afterwards.
@see: built() and File.release_target_info()
"""
pass
# #
# #
# #
@ -501,7 +538,7 @@ class Node(object):
def is_derived(self): def is_derived(self):
""" """
Returns true iff this node is derived (i.e. built). Returns true if this node is derived (i.e. built).
This should return true only for nodes whose path should be in This should return true only for nodes whose path should be in
the variant directory when duplicate=0 and should contribute their build the variant directory when duplicate=0 and should contribute their build
@ -788,6 +825,10 @@ class Node(object):
"""Set the Node's precious value.""" """Set the Node's precious value."""
self.precious = precious self.precious = precious
def set_pseudo(self, pseudo = True):
"""Set the Node's precious value."""
self.pseudo = pseudo
def set_noclean(self, noclean = 1): def set_noclean(self, noclean = 1):
"""Set the Node's noclean value.""" """Set the Node's noclean value."""
# Make sure noclean is an integer so the --debug=stree # Make sure noclean is an integer so the --debug=stree
@ -837,6 +878,8 @@ class Node(object):
def add_prerequisite(self, prerequisite): def add_prerequisite(self, prerequisite):
"""Adds prerequisites""" """Adds prerequisites"""
if self.prerequisites is None:
self.prerequisites = SCons.Util.UniqueList()
self.prerequisites.extend(prerequisite) self.prerequisites.extend(prerequisite)
self._children_reset() self._children_reset()
@ -924,20 +967,14 @@ class Node(object):
# dictionary patterns I found all ended up using "not in" # dictionary patterns I found all ended up using "not in"
# internally anyway...) # internally anyway...)
if self.ignore_set: if self.ignore_set:
if self.implicit is None: iter = chain.from_iterable(filter(None, [self.sources, self.depends, self.implicit]))
iter = chain(self.sources,self.depends)
else:
iter = chain(self.sources, self.depends, self.implicit)
children = [] children = []
for i in iter: for i in iter:
if i not in self.ignore_set: if i not in self.ignore_set:
children.append(i) children.append(i)
else: else:
if self.implicit is None: children = self.all_children(scan=0)
children = self.sources + self.depends
else:
children = self.sources + self.depends + self.implicit
self._memo['children_get'] = children self._memo['children_get'] = children
return children return children
@ -964,10 +1001,7 @@ class Node(object):
# using dictionary keys, lose the order, and the only ordered # using dictionary keys, lose the order, and the only ordered
# dictionary patterns I found all ended up using "not in" # dictionary patterns I found all ended up using "not in"
# internally anyway...) # internally anyway...)
if self.implicit is None: return list(chain.from_iterable(filter(None, [self.sources, self.depends, self.implicit])))
return self.sources + self.depends
else:
return self.sources + self.depends + self.implicit
def children(self, scan=1): def children(self, scan=1):
"""Return a list of the node's direct children, minus those """Return a list of the node's direct children, minus those
@ -1015,7 +1049,7 @@ class Node(object):
def Decider(self, function): def Decider(self, function):
SCons.Util.AddMethod(self, function, 'changed_since_last_build') SCons.Util.AddMethod(self, function, 'changed_since_last_build')
def changed(self, node=None): def changed(self, node=None, allowcache=False):
""" """
Returns if the node is up-to-date with respect to the BuildInfo Returns if the node is up-to-date with respect to the BuildInfo
stored last time it was built. The default behavior is to compare stored last time it was built. The default behavior is to compare
@ -1028,6 +1062,15 @@ class Node(object):
any difference, but we now rely on checking every dependency any difference, but we now rely on checking every dependency
to make sure that any necessary Node information (for example, to make sure that any necessary Node information (for example,
the content signature of an #included .h file) is updated. the content signature of an #included .h file) is updated.
The allowcache option was added for supporting the early
release of the executor/builder structures, right after
a File target was built. When set to true, the return
value of this changed method gets cached for File nodes.
Like this, the executor isn't needed any longer for subsequent
calls to changed().
@see: FS.File.changed(), FS.File.release_target_info()
""" """
t = 0 t = 0
if t: Trace('changed(%s [%s], %s)' % (self, classname(self), node)) if t: Trace('changed(%s [%s], %s)' % (self, classname(self), node))
@ -1103,17 +1146,18 @@ class Node(object):
Return a text representation, suitable for displaying to the Return a text representation, suitable for displaying to the
user, of the include tree for the sources of this node. user, of the include tree for the sources of this node.
""" """
if self.is_derived() and self.env: if self.is_derived():
env = self.get_build_env() env = self.get_build_env()
for s in self.sources: if env:
scanner = self.get_source_scanner(s) for s in self.sources:
if scanner: scanner = self.get_source_scanner(s)
path = self.get_build_scanner_path(scanner) if scanner:
else: path = self.get_build_scanner_path(scanner)
path = None else:
def f(node, env=env, scanner=scanner, path=path): path = None
return node.get_found_includes(env, scanner, path) def f(node, env=env, scanner=scanner, path=path):
return SCons.Util.render_tree(s, f, 1) return node.get_found_includes(env, scanner, path)
return SCons.Util.render_tree(s, f, 1)
else: else:
return None return None

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Options/BoolOption.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Options/BoolOption.py 2014/03/02 14:18:15 garyo"
__doc__ = """Place-holder for the old SCons.Options module hierarchy __doc__ = """Place-holder for the old SCons.Options module hierarchy

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Options/EnumOption.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Options/EnumOption.py 2014/03/02 14:18:15 garyo"
__doc__ = """Place-holder for the old SCons.Options module hierarchy __doc__ = """Place-holder for the old SCons.Options module hierarchy

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Options/ListOption.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Options/ListOption.py 2014/03/02 14:18:15 garyo"
__doc__ = """Place-holder for the old SCons.Options module hierarchy __doc__ = """Place-holder for the old SCons.Options module hierarchy

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Options/PackageOption.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Options/PackageOption.py 2014/03/02 14:18:15 garyo"
__doc__ = """Place-holder for the old SCons.Options module hierarchy __doc__ = """Place-holder for the old SCons.Options module hierarchy

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Options/PathOption.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Options/PathOption.py 2014/03/02 14:18:15 garyo"
__doc__ = """Place-holder for the old SCons.Options module hierarchy __doc__ = """Place-holder for the old SCons.Options module hierarchy

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Options/__init__.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Options/__init__.py 2014/03/02 14:18:15 garyo"
__doc__ = """Place-holder for the old SCons.Options module hierarchy __doc__ = """Place-holder for the old SCons.Options module hierarchy

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/PathList.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/PathList.py 2014/03/02 14:18:15 garyo"
__doc__ = """SCons.PathList __doc__ = """SCons.PathList

View file

@ -20,7 +20,7 @@ their own platform definition.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -42,7 +42,7 @@ their own platform definition.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Platform/__init__.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Platform/__init__.py 2014/03/02 14:18:15 garyo"
import SCons.compat import SCons.compat

View file

@ -8,7 +8,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Platform/aix.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Platform/aix.py 2014/03/02 14:18:15 garyo"
import os import os

View file

@ -8,7 +8,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Platform/cygwin.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Platform/cygwin.py 2014/03/02 14:18:15 garyo"
import posix import posix
from SCons.Platform import TempFileMunge from SCons.Platform import TempFileMunge

View file

@ -8,7 +8,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Platform/darwin.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Platform/darwin.py 2014/03/02 14:18:15 garyo"
import posix import posix
import os import os

View file

@ -8,7 +8,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Platform/hpux.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Platform/hpux.py 2014/03/02 14:18:15 garyo"
import posix import posix

View file

@ -8,7 +8,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Platform/irix.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Platform/irix.py 2014/03/02 14:18:15 garyo"
import posix import posix

View file

@ -8,7 +8,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Platform/os2.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Platform/os2.py 2014/03/02 14:18:15 garyo"
import win32 import win32
def generate(env): def generate(env):

View file

@ -0,0 +1,120 @@
"""SCons.Platform.posix
Platform-specific initialization for POSIX (Linux, UNIX, etc.) systems.
There normally shouldn't be any need to import this module directly. It
will usually be imported through the generic SCons.Platform.Platform()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
__revision__ = "src/engine/SCons/Platform/posix.py 2014/03/02 14:18:15 garyo"
import errno
import os
import os.path
import subprocess
import sys
import select
import SCons.Util
from SCons.Platform import TempFileMunge
exitvalmap = {
2 : 127,
13 : 126,
}
def escape(arg):
"escape shell special characters"
slash = '\\'
special = '"$()'
arg = arg.replace(slash, slash+slash)
for c in special:
arg = arg.replace(c, slash+c)
return '"' + arg + '"'
def exec_subprocess(l, env):
proc = subprocess.Popen(l, env = env, close_fds = True)
return proc.wait()
def subprocess_spawn(sh, escape, cmd, args, env):
return exec_subprocess([sh, '-c', ' '.join(args)], env)
def exec_popen3(l, env, stdout, stderr):
proc = subprocess.Popen(l, env = env, close_fds = True,
stdout = stdout,
stderr = stderr)
return proc.wait()
def piped_env_spawn(sh, escape, cmd, args, env, stdout, stderr):
# spawn using Popen3 combined with the env command
# the command name and the command's stdout is written to stdout
# the command's stderr is written to stderr
return exec_popen3([sh, '-c', ' '.join(args)],
env, stdout, stderr)
def generate(env):
# Bearing in mind we have python 2.4 as a baseline, we can just do this:
spawn = subprocess_spawn
pspawn = piped_env_spawn
# Note that this means that 'escape' is no longer used
if 'ENV' not in env:
env['ENV'] = {}
env['ENV']['PATH'] = '/usr/local/bin:/opt/bin:/bin:/usr/bin'
env['OBJPREFIX'] = ''
env['OBJSUFFIX'] = '.o'
env['SHOBJPREFIX'] = '$OBJPREFIX'
env['SHOBJSUFFIX'] = '$OBJSUFFIX'
env['PROGPREFIX'] = ''
env['PROGSUFFIX'] = ''
env['LIBPREFIX'] = 'lib'
env['LIBSUFFIX'] = '.a'
env['SHLIBPREFIX'] = '$LIBPREFIX'
env['SHLIBSUFFIX'] = '.so'
env['LIBPREFIXES'] = [ '$LIBPREFIX' ]
env['LIBSUFFIXES'] = [ '$LIBSUFFIX', '$SHLIBSUFFIX' ]
env['PSPAWN'] = pspawn
env['SPAWN'] = spawn
env['SHELL'] = 'sh'
env['ESCAPE'] = escape
env['TEMPFILE'] = TempFileMunge
env['TEMPFILEPREFIX'] = '@'
#Based on LINUX: ARG_MAX=ARG_MAX=131072 - 3000 for environment expansion
#Note: specific platforms might rise or lower this value
env['MAXLINELENGTH'] = 128072
# This platform supports RPATH specifications.
env['__RPATH'] = '$_RPATH'
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:

View file

@ -8,7 +8,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Platform/sunos.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Platform/sunos.py 2014/03/02 14:18:15 garyo"
import posix import posix

View file

@ -8,7 +8,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Platform/win32.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Platform/win32.py 2014/03/02 14:18:15 garyo"
import os import os
import os.path import os.path

View file

@ -4,7 +4,7 @@ Autoconf-like configuration support.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -26,7 +26,7 @@ Autoconf-like configuration support.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/SConf.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/SConf.py 2014/03/02 14:18:15 garyo"
import SCons.compat import SCons.compat
@ -483,6 +483,9 @@ class SConfBase(object):
# so we really control how it gets written. # so we really control how it gets written.
for n in nodes: for n in nodes:
n.store_info = n.do_not_store_info n.store_info = n.do_not_store_info
if not hasattr(n, 'attributes'):
n.attributes = SCons.Node.Node.Attrs()
n.attributes.keep_targetinfo = 1
ret = 1 ret = 1
@ -776,19 +779,16 @@ class CheckContext(object):
self.did_show_result = 0 self.did_show_result = 0
def Result(self, res): def Result(self, res):
"""Inform about the result of the test. res may be an integer or a """Inform about the result of the test. If res is not a string, displays
string. In case of an integer, the written text will be 'yes' or 'no'. 'yes' or 'no' depending on whether res is evaluated as true or false.
The result is only displayed when self.did_show_result is not set. The result is only displayed when self.did_show_result is not set.
""" """
if isinstance(res, (int, bool)): if isinstance(res, str):
if res:
text = "yes"
else:
text = "no"
elif isinstance(res, str):
text = res text = res
elif res:
text = "yes"
else: else:
raise TypeError("Expected string, int or bool, got " + str(type(res))) text = "no"
if self.did_show_result == 0: if self.did_show_result == 0:
# Didn't show result yet, do it now. # Didn't show result yet, do it now.

View file

@ -5,7 +5,7 @@ Writing and reading information to the .sconsign file or files.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -27,7 +27,7 @@ Writing and reading information to the .sconsign file or files.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/SConsign.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/SConsign.py 2014/03/02 14:18:15 garyo"
import SCons.compat import SCons.compat

View file

@ -5,7 +5,7 @@ This module implements the depenency scanner for C/C++ code.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -27,7 +27,7 @@ This module implements the depenency scanner for C/C++ code.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Scanner/C.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Scanner/C.py 2014/03/02 14:18:15 garyo"
import SCons.Node.FS import SCons.Node.FS
import SCons.Scanner import SCons.Scanner

View file

@ -8,7 +8,7 @@ Coded by Andy Friesen
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ Coded by Andy Friesen
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Scanner/D.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Scanner/D.py 2014/03/02 14:18:15 garyo"
import re import re

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -20,7 +20,7 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Scanner/Dir.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Scanner/Dir.py 2014/03/02 14:18:15 garyo"
import SCons.Node.FS import SCons.Node.FS
import SCons.Scanner import SCons.Scanner

View file

@ -5,7 +5,7 @@ This module implements the dependency scanner for Fortran code.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -26,7 +26,7 @@ This module implements the dependency scanner for Fortran code.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Scanner/Fortran.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Scanner/Fortran.py 2014/03/02 14:18:15 garyo"
import re import re

View file

@ -6,7 +6,7 @@ Definition Language) files.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -28,7 +28,7 @@ Definition Language) files.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Scanner/IDL.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Scanner/IDL.py 2014/03/02 14:18:15 garyo"
import SCons.Node.FS import SCons.Node.FS
import SCons.Scanner import SCons.Scanner

View file

@ -5,7 +5,7 @@ This module implements the dependency scanner for LaTeX code.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -27,7 +27,7 @@ This module implements the dependency scanner for LaTeX code.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Scanner/LaTeX.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Scanner/LaTeX.py 2014/03/02 14:18:15 garyo"
import os.path import os.path
import re import re

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Scanner/Prog.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Scanner/Prog.py 2014/03/02 14:18:15 garyo"
import SCons.Node import SCons.Node
import SCons.Node.FS import SCons.Node.FS

View file

@ -6,7 +6,7 @@ Definition Language) files.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -28,7 +28,7 @@ Definition Language) files.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Scanner/RC.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Scanner/RC.py 2014/03/02 14:18:15 garyo"
import SCons.Node.FS import SCons.Node.FS
import SCons.Scanner import SCons.Scanner

View file

@ -5,7 +5,7 @@ The Scanner package for the SCons software construction utility.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -27,7 +27,7 @@ The Scanner package for the SCons software construction utility.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Scanner/__init__.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Scanner/__init__.py 2014/03/02 14:18:15 garyo"
import re import re

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -20,7 +20,7 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Script/Interactive.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Script/Interactive.py 2014/03/02 14:18:15 garyo"
__doc__ = """ __doc__ = """
SCons interactive mode SCons interactive mode

View file

@ -13,7 +13,7 @@ it goes here.
unsupported_python_version = (2, 3, 0) unsupported_python_version = (2, 3, 0)
deprecated_python_version = (2, 7, 0) deprecated_python_version = (2, 7, 0)
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -34,7 +34,7 @@ deprecated_python_version = (2, 7, 0)
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Script/Main.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Script/Main.py 2014/03/02 14:18:15 garyo"
import SCons.compat import SCons.compat
@ -79,7 +79,12 @@ def fetch_win32_parallel_msg():
import SCons.Platform.win32 import SCons.Platform.win32
return SCons.Platform.win32.parallel_msg return SCons.Platform.win32.parallel_msg
# def revert_io():
# This call is added to revert stderr and stdout to the original
# ones just in case some build rule or something else in the system
# has redirected them elsewhere.
sys.stderr = sys.__stderr__
sys.stdout = sys.__stdout__
class SConsPrintHelpException(Exception): class SConsPrintHelpException(Exception):
pass pass
@ -272,6 +277,9 @@ class BuildTask(SCons.Taskmaster.OutOfDateTask):
(EnvironmentError, SCons.Errors.StopError, (EnvironmentError, SCons.Errors.StopError,
SCons.Errors.UserError))): SCons.Errors.UserError))):
type, value, trace = buildError.exc_info type, value, trace = buildError.exc_info
if tb and print_stacktrace:
sys.stderr.write("scons: internal stack trace:\n")
traceback.print_tb(tb, file=sys.stderr)
traceback.print_exception(type, value, trace) traceback.print_exception(type, value, trace)
elif tb and print_stacktrace: elif tb and print_stacktrace:
sys.stderr.write("scons: internal stack trace:\n") sys.stderr.write("scons: internal stack trace:\n")
@ -622,7 +630,7 @@ def _set_debug_values(options):
debug_values = options.debug debug_values = options.debug
if "count" in debug_values: if "count" in debug_values:
# All of the object counts are within "if __debug__:" blocks, # All of the object counts are within "if track_instances:" blocks,
# which get stripped when running optimized (with python -O or # which get stripped when running optimized (with python -O or
# from compiled *.pyo files). Provide a warning if __debug__ is # from compiled *.pyo files). Provide a warning if __debug__ is
# stripped, so it doesn't just look like --debug=count is broken. # stripped, so it doesn't just look like --debug=count is broken.
@ -630,6 +638,7 @@ def _set_debug_values(options):
if __debug__: enable_count = True if __debug__: enable_count = True
if enable_count: if enable_count:
count_stats.enable(sys.stdout) count_stats.enable(sys.stdout)
SCons.Debug.track_instances = True
else: else:
msg = "--debug=count is not supported when running SCons\n" + \ msg = "--debug=count is not supported when running SCons\n" + \
"\twith the python -O option or optimized (.pyo) modules." "\twith the python -O option or optimized (.pyo) modules."
@ -644,6 +653,8 @@ def _set_debug_values(options):
if "memory" in debug_values: if "memory" in debug_values:
memory_stats.enable(sys.stdout) memory_stats.enable(sys.stdout)
print_objects = ("objects" in debug_values) print_objects = ("objects" in debug_values)
if print_objects:
SCons.Debug.track_instances = True
if "presub" in debug_values: if "presub" in debug_values:
SCons.Action.print_actions_presub = 1 SCons.Action.print_actions_presub = 1
if "stacktrace" in debug_values: if "stacktrace" in debug_values:
@ -983,9 +994,9 @@ def _main(parser):
# reading SConscript files and haven't started building # reading SConscript files and haven't started building
# things yet, stop regardless of whether they used -i or -k # things yet, stop regardless of whether they used -i or -k
# or anything else. # or anything else.
revert_io()
sys.stderr.write("scons: *** %s Stop.\n" % e) sys.stderr.write("scons: *** %s Stop.\n" % e)
exit_status = 2 sys.exit(2)
sys.exit(exit_status)
global sconscript_time global sconscript_time
sconscript_time = time.time() - start_time sconscript_time = time.time() - start_time
@ -1063,6 +1074,7 @@ def _main(parser):
platform = SCons.Platform.platform_module() platform = SCons.Platform.platform_module()
if options.interactive: if options.interactive:
SCons.Node.interactive = True
SCons.Script.Interactive.interact(fs, OptionsParser, options, SCons.Script.Interactive.interact(fs, OptionsParser, options,
targets, target_top) targets, target_top)
@ -1071,6 +1083,8 @@ def _main(parser):
# Build the targets # Build the targets
nodes = _build_targets(fs, options, targets, target_top) nodes = _build_targets(fs, options, targets, target_top)
if not nodes: if not nodes:
revert_io()
print 'Found nothing to build'
exit_status = 2 exit_status = 2
def _build_targets(fs, options, targets, target_top): def _build_targets(fs, options, targets, target_top):
@ -1083,12 +1097,14 @@ def _build_targets(fs, options, targets, target_top):
SCons.Action.print_actions = not options.silent SCons.Action.print_actions = not options.silent
SCons.Action.execute_actions = not options.no_exec SCons.Action.execute_actions = not options.no_exec
SCons.Node.FS.do_store_info = not options.no_exec SCons.Node.FS.do_store_info = not options.no_exec
SCons.Node.do_store_info = not options.no_exec
SCons.SConf.dryrun = options.no_exec SCons.SConf.dryrun = options.no_exec
if options.diskcheck: if options.diskcheck:
SCons.Node.FS.set_diskcheck(options.diskcheck) SCons.Node.FS.set_diskcheck(options.diskcheck)
SCons.CacheDir.cache_enabled = not options.cache_disable SCons.CacheDir.cache_enabled = not options.cache_disable
SCons.CacheDir.cache_readonly = options.cache_readonly
SCons.CacheDir.cache_debug = options.cache_debug SCons.CacheDir.cache_debug = options.cache_debug
SCons.CacheDir.cache_force = options.cache_force SCons.CacheDir.cache_force = options.cache_force
SCons.CacheDir.cache_show = options.cache_show SCons.CacheDir.cache_show = options.cache_show
@ -1298,12 +1314,8 @@ def _exec_main(parser, values):
prof = Profile() prof = Profile()
try: try:
prof.runcall(_main, parser) prof.runcall(_main, parser)
except SConsPrintHelpException, e: finally:
prof.dump_stats(options.profile_file) prof.dump_stats(options.profile_file)
raise e
except SystemExit:
pass
prof.dump_stats(options.profile_file)
else: else:
_main(parser) _main(parser)
@ -1331,7 +1343,7 @@ def main():
pass pass
parts.append(version_string("engine", SCons)) parts.append(version_string("engine", SCons))
parts.append(path_string("engine", SCons)) parts.append(path_string("engine", SCons))
parts.append("Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation") parts.append("Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation")
version = ''.join(parts) version = ''.join(parts)
import SConsOptions import SConsOptions
@ -1341,7 +1353,10 @@ def main():
OptionsParser = parser OptionsParser = parser
try: try:
_exec_main(parser, values) try:
_exec_main(parser, values)
finally:
revert_io()
except SystemExit, s: except SystemExit, s:
if s: if s:
exit_status = s exit_status = s
@ -1358,6 +1373,7 @@ def main():
parser.print_help() parser.print_help()
exit_status = 0 exit_status = 0
except SCons.Errors.BuildError, e: except SCons.Errors.BuildError, e:
print e
exit_status = e.exitstatus exit_status = e.exitstatus
except: except:
# An exception here is likely a builtin Python exception Python # An exception here is likely a builtin Python exception Python

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Script/SConsOptions.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Script/SConsOptions.py 2014/03/02 14:18:15 garyo"
import optparse import optparse
import re import re
@ -248,7 +248,7 @@ class SConsOption(optparse.Option):
class SConsOptionGroup(optparse.OptionGroup): class SConsOptionGroup(optparse.OptionGroup):
""" """
A subclass for SCons-specific option groups. A subclass for SCons-specific option groups.
The only difference between this and the base class is that we print The only difference between this and the base class is that we print
the group's help text flush left, underneath their own title but the group's help text flush left, underneath their own title but
lined up with the normal "SCons Options". lined up with the normal "SCons Options".
@ -337,10 +337,75 @@ class SConsOptionParser(optparse.OptionParser):
option.process(opt, value, values, self) option.process(opt, value, values, self)
def reparse_local_options(self):
"""
Re-parse the leftover command-line options stored
in self.largs, so that any value overridden on the
command line is immediately available if the user turns
around and does a GetOption() right away.
We mimic the processing of the single args
in the original OptionParser._process_args(), but here we
allow exact matches for long-opts only (no partial
argument names!).
Else, this would lead to problems in add_local_option()
below. When called from there, we try to reparse the
command-line arguments that
1. haven't been processed so far (self.largs), but
2. are possibly not added to the list of options yet.
So, when we only have a value for "--myargument" yet,
a command-line argument of "--myarg=test" would set it.
Responsible for this behaviour is the method
_match_long_opt(), which allows for partial matches of
the option name, as long as the common prefix appears to
be unique.
This would lead to further confusion, because we might want
to add another option "--myarg" later on (see issue #2929).
"""
rargs = []
largs_restore = []
# Loop over all remaining arguments
skip = False
for l in self.largs:
if skip:
# Accept all remaining arguments as they are
largs_restore.append(l)
else:
if len(l) > 2 and l[0:2] == "--":
# Check long option
lopt = (l,)
if "=" in l:
# Split into option and value
lopt = l.split("=", 1)
if lopt[0] in self._long_opt:
# Argument is already known
rargs.append('='.join(lopt))
else:
# Not known yet, so reject for now
largs_restore.append('='.join(lopt))
else:
if l == "--" or l == "-":
# Stop normal processing and don't
# process the rest of the command-line opts
largs_restore.append(l)
skip = True
else:
rargs.append(l)
# Parse the filtered list
self.parse_args(rargs, self.values)
# Restore the list of remaining arguments for the
# next call of AddOption/add_local_option...
self.largs = self.largs + largs_restore
def add_local_option(self, *args, **kw): def add_local_option(self, *args, **kw):
""" """
Adds a local option to the parser. Adds a local option to the parser.
This is initiated by a SetOption() call to add a user-defined This is initiated by a SetOption() call to add a user-defined
command-line option. We add the option to a separate option command-line option. We add the option to a separate option
group for the local options, creating the group if necessary. group for the local options, creating the group if necessary.
@ -364,7 +429,7 @@ class SConsOptionParser(optparse.OptionParser):
# available if the user turns around and does a GetOption() # available if the user turns around and does a GetOption()
# right away. # right away.
setattr(self.values.__defaults__, result.dest, result.default) setattr(self.values.__defaults__, result.dest, result.default)
self.parse_args(self.largs, self.values) self.reparse_local_options()
return result return result
@ -394,11 +459,11 @@ class SConsIndentedHelpFormatter(optparse.IndentedHelpFormatter):
out liking: out liking:
-- add our own regular expression that doesn't break on hyphens -- add our own regular expression that doesn't break on hyphens
(so things like --no-print-directory don't get broken); (so things like --no-print-directory don't get broken);
-- wrap the list of options themselves when it's too long -- wrap the list of options themselves when it's too long
(the wrapper.fill(opts) call below); (the wrapper.fill(opts) call below);
-- set the subsequent_indent when wrapping the help_text. -- set the subsequent_indent when wrapping the help_text.
""" """
# The help for each option consists of two parts: # The help for each option consists of two parts:
@ -564,6 +629,11 @@ def Parser(version):
action="store_true", action="store_true",
help="Copy already-built targets into the CacheDir.") help="Copy already-built targets into the CacheDir.")
op.add_option('--cache-readonly',
dest='cache_readonly', default=False,
action="store_true",
help="Do not update CacheDir with built targets.")
op.add_option('--cache-show', op.add_option('--cache-show',
dest='cache_show', default=False, dest='cache_show', default=False,
action="store_true", action="store_true",
@ -579,8 +649,10 @@ def Parser(version):
if not value in c_options: if not value in c_options:
raise OptionValueError(opt_invalid('config', value, c_options)) raise OptionValueError(opt_invalid('config', value, c_options))
setattr(parser.values, option.dest, value) setattr(parser.values, option.dest, value)
opt_config_help = "Controls Configure subsystem: %s." \ opt_config_help = "Controls Configure subsystem: %s." \
% ", ".join(config_options) % ", ".join(config_options)
op.add_option('--config', op.add_option('--config',
nargs=1, type="string", nargs=1, type="string",
dest="config", default="auto", dest="config", default="auto",
@ -606,23 +678,25 @@ def Parser(version):
"pdb", "prepare", "presub", "stacktrace", "pdb", "prepare", "presub", "stacktrace",
"time"] "time"]
def opt_debug(option, opt, value, parser, def opt_debug(option, opt, value__, parser,
debug_options=debug_options, debug_options=debug_options,
deprecated_debug_options=deprecated_debug_options): deprecated_debug_options=deprecated_debug_options):
if value in debug_options: for value in value__.split(','):
parser.values.debug.append(value) if value in debug_options:
elif value in deprecated_debug_options.keys(): parser.values.debug.append(value)
parser.values.debug.append(value) elif value in deprecated_debug_options.keys():
try: parser.values.debug.append(value)
parser.values.delayed_warnings try:
except AttributeError: parser.values.delayed_warnings
parser.values.delayed_warnings = [] except AttributeError:
msg = deprecated_debug_options[value] parser.values.delayed_warnings = []
w = "The --debug=%s option is deprecated%s." % (value, msg) msg = deprecated_debug_options[value]
t = (SCons.Warnings.DeprecatedDebugOptionsWarning, w) w = "The --debug=%s option is deprecated%s." % (value, msg)
parser.values.delayed_warnings.append(t) t = (SCons.Warnings.DeprecatedDebugOptionsWarning, w)
else: parser.values.delayed_warnings.append(t)
raise OptionValueError(opt_invalid('debug', value, debug_options)) else:
raise OptionValueError(opt_invalid('debug', value, debug_options))
opt_debug_help = "Print various types of debugging information: %s." \ opt_debug_help = "Print various types of debugging information: %s." \
% ", ".join(debug_options) % ", ".join(debug_options)
op.add_option('--debug', op.add_option('--debug',

View file

@ -6,7 +6,7 @@ files.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -28,7 +28,7 @@ files.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from __future__ import division from __future__ import division
__revision__ = "src/engine/SCons/Script/SConscript.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Script/SConscript.py 2014/03/02 14:18:15 garyo"
import SCons import SCons
import SCons.Action import SCons.Action

View file

@ -12,7 +12,7 @@ it goes here.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -34,7 +34,7 @@ it goes here.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Script/__init__.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Script/__init__.py 2014/03/02 14:18:15 garyo"
import time import time
start_time = time.time() start_time = time.time()

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Sig.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Sig.py 2014/03/02 14:18:15 garyo"
__doc__ = """Place-holder for the old SCons.Sig module hierarchy __doc__ = """Place-holder for the old SCons.Sig module hierarchy

View file

@ -5,7 +5,7 @@ SCons string substitution.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -26,7 +26,7 @@ SCons string substitution.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Subst.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Subst.py 2014/03/02 14:18:15 garyo"
import collections import collections
import re import re
@ -78,6 +78,14 @@ class Literal(object):
def is_literal(self): def is_literal(self):
return 1 return 1
def __eq__(self, other):
if not isinstance(other, Literal):
return False
return self.lstr == other.lstr
def __neq__(self, other):
return not self.__eq__(other)
class SpecialAttrWrapper(object): class SpecialAttrWrapper(object):
"""This is a wrapper for what we call a 'Node special attribute.' """This is a wrapper for what we call a 'Node special attribute.'
This is any of the attributes of a Node that we can reference from This is any of the attributes of a Node that we can reference from
@ -172,7 +180,7 @@ class NLWrapper(object):
In practice, this might be a wash performance-wise, but it's a little In practice, this might be a wash performance-wise, but it's a little
cleaner conceptually... cleaner conceptually...
""" """
def __init__(self, list, func): def __init__(self, list, func):
self.list = list self.list = list
self.func = func self.func = func
@ -190,7 +198,7 @@ class NLWrapper(object):
self._create_nodelist = self._return_nodelist self._create_nodelist = self._return_nodelist
return self.nodelist return self.nodelist
_create_nodelist = _gen_nodelist _create_nodelist = _gen_nodelist
class Targets_or_Sources(collections.UserList): class Targets_or_Sources(collections.UserList):
"""A class that implements $TARGETS or $SOURCES expansions by in turn """A class that implements $TARGETS or $SOURCES expansions by in turn
@ -451,7 +459,7 @@ def scons_subst(strSubst, env, mode=SUBST_RAW, target=None, source=None, gvars={
raise_exception(NameError(key), lvars['TARGETS'], s) raise_exception(NameError(key), lvars['TARGETS'], s)
else: else:
return '' return ''
# Before re-expanding the result, handle # Before re-expanding the result, handle
# recursive expansion by copying the local # recursive expansion by copying the local
# variable dictionary and overwriting a null # variable dictionary and overwriting a null

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -47,7 +47,7 @@ interface and the SCons build engine. There are two key classes here:
target(s) that it decides need to be evaluated and/or built. target(s) that it decides need to be evaluated and/or built.
""" """
__revision__ = "src/engine/SCons/Taskmaster.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Taskmaster.py 2014/03/02 14:18:15 garyo"
from itertools import chain from itertools import chain
import operator import operator
@ -186,6 +186,8 @@ class Task(object):
# or implicit dependencies exists, and also initialize the # or implicit dependencies exists, and also initialize the
# .sconsign info. # .sconsign info.
executor = self.targets[0].get_executor() executor = self.targets[0].get_executor()
if executor is None:
return
executor.prepare() executor.prepare()
for t in executor.get_action_targets(): for t in executor.get_action_targets():
if print_prepare: if print_prepare:
@ -289,6 +291,7 @@ class Task(object):
post-visit actions that must take place regardless of whether post-visit actions that must take place regardless of whether
or not the target was an actual built target or a source Node. or not the target was an actual built target or a source Node.
""" """
global print_prepare
T = self.tm.trace T = self.tm.trace
if T: T.write(self.trace_message('Task.executed_with_callbacks()', if T: T.write(self.trace_message('Task.executed_with_callbacks()',
self.node)) self.node))
@ -301,7 +304,12 @@ class Task(object):
if not t.cached: if not t.cached:
t.push_to_cache() t.push_to_cache()
t.built() t.built()
t.visited() t.visited()
if (not print_prepare and
(not hasattr(self, 'options') or not self.options.debug_includes)):
t.release_target_info()
else:
t.visited()
executed = executed_with_callbacks executed = executed_with_callbacks
@ -382,6 +390,7 @@ class Task(object):
This is the default behavior for building only what's necessary. This is the default behavior for building only what's necessary.
""" """
global print_prepare
T = self.tm.trace T = self.tm.trace
if T: T.write(self.trace_message(u'Task.make_ready_current()', if T: T.write(self.trace_message(u'Task.make_ready_current()',
self.node)) self.node))
@ -414,6 +423,9 @@ class Task(object):
# parallel build...) # parallel build...)
t.visited() t.visited()
t.set_state(NODE_UP_TO_DATE) t.set_state(NODE_UP_TO_DATE)
if (not print_prepare and
(not hasattr(self, 'options') or not self.options.debug_includes)):
t.release_target_info()
make_ready = make_ready_current make_ready = make_ready_current
@ -453,14 +465,15 @@ class Task(object):
parents[p] = parents.get(p, 0) + 1 parents[p] = parents.get(p, 0) + 1
for t in targets: for t in targets:
for s in t.side_effects: if t.side_effects is not None:
if s.get_state() == NODE_EXECUTING: for s in t.side_effects:
s.set_state(NODE_NO_STATE) if s.get_state() == NODE_EXECUTING:
for p in s.waiting_parents: s.set_state(NODE_NO_STATE)
parents[p] = parents.get(p, 0) + 1 for p in s.waiting_parents:
for p in s.waiting_s_e: parents[p] = parents.get(p, 0) + 1
if p.ref_count == 0: for p in s.waiting_s_e:
self.tm.candidates.append(p) if p.ref_count == 0:
self.tm.candidates.append(p)
for p, subtract in parents.items(): for p, subtract in parents.items():
p.ref_count = p.ref_count - subtract p.ref_count = p.ref_count - subtract
@ -927,7 +940,11 @@ class Taskmaster(object):
if node is None: if node is None:
return None return None
tlist = node.get_executor().get_all_targets() executor = node.get_executor()
if executor is None:
return None
tlist = executor.get_all_targets()
task = self.tasker(self, tlist, node in self.original_top, node) task = self.tasker(self, tlist, node in self.original_top, node)
try: try:

View file

@ -10,7 +10,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -32,7 +32,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/386asm.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/386asm.py 2014/03/02 14:18:15 garyo"
from SCons.Tool.PharLapCommon import addPharLapPaths from SCons.Tool.PharLapCommon import addPharLapPaths
import SCons.Util import SCons.Util

View file

@ -10,7 +10,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -32,7 +32,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/BitKeeper.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/BitKeeper.py 2014/03/02 14:18:15 garyo"
import SCons.Action import SCons.Action
import SCons.Builder import SCons.Builder

View file

@ -8,7 +8,7 @@ selection method.
""" """
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -29,7 +29,7 @@ selection method.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/CVS.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/CVS.py 2014/03/02 14:18:15 garyo"
import SCons.Action import SCons.Action
import SCons.Builder import SCons.Builder

View file

@ -5,7 +5,7 @@ Stuff for processing Fortran, common to all fortran dialects.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -27,7 +27,7 @@ Stuff for processing Fortran, common to all fortran dialects.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/FortranCommon.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/FortranCommon.py 2014/03/02 14:18:15 garyo"
import re import re
import os.path import os.path

View file

@ -3,7 +3,7 @@
Used by several tools of `gettext` toolset. Used by several tools of `gettext` toolset.
""" """
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -24,7 +24,7 @@ Used by several tools of `gettext` toolset.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/GettextCommon.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/GettextCommon.py 2014/03/02 14:18:15 garyo"
import SCons.Warnings import SCons.Warnings
import re import re

View file

@ -5,7 +5,7 @@ Stuff for processing Java.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -27,7 +27,7 @@ Stuff for processing Java.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/JavaCommon.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/JavaCommon.py 2014/03/02 14:18:15 garyo"
import os import os
import os.path import os.path

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/MSCommon/__init__.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/MSCommon/__init__.py 2014/03/02 14:18:15 garyo"
__doc__ = """ __doc__ = """
Common functions for Microsoft Visual Studio and Visual C/C++. Common functions for Microsoft Visual Studio and Visual C/C++.

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/MSCommon/arch.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/MSCommon/arch.py 2014/03/02 14:18:15 garyo"
__doc__ = """Module to define supported Windows chip architectures. __doc__ = """Module to define supported Windows chip architectures.
""" """

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/MSCommon/common.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/MSCommon/common.py 2014/03/02 14:18:15 garyo"
__doc__ = """ __doc__ = """
Common helper functions for working with the Microsoft tool chain. Common helper functions for working with the Microsoft tool chain.
@ -55,12 +55,12 @@ _is_win64 = None
def is_win64(): def is_win64():
"""Return true if running on windows 64 bits. """Return true if running on windows 64 bits.
Works whether python itself runs in 64 bits or 32 bits.""" Works whether python itself runs in 64 bits or 32 bits."""
# Unfortunately, python does not provide a useful way to determine # Unfortunately, python does not provide a useful way to determine
# if the underlying Windows OS is 32-bit or 64-bit. Worse, whether # if the underlying Windows OS is 32-bit or 64-bit. Worse, whether
# the Python itself is 32-bit or 64-bit affects what it returns, # the Python itself is 32-bit or 64-bit affects what it returns,
# so nothing in sys.* or os.* help. # so nothing in sys.* or os.* help.
# Apparently the best solution is to use env vars that Windows # Apparently the best solution is to use env vars that Windows
# sets. If PROCESSOR_ARCHITECTURE is not x86, then the python # sets. If PROCESSOR_ARCHITECTURE is not x86, then the python
@ -120,11 +120,21 @@ def normalize_env(env, keys, force=False):
if k in os.environ and (force or not k in normenv): if k in os.environ and (force or not k in normenv):
normenv[k] = os.environ[k].encode('mbcs') normenv[k] = os.environ[k].encode('mbcs')
# This shouldn't be necessary, since the default environment should include system32,
# but keep this here to be safe, since it's needed to find reg.exe which the MSVC
# bat scripts use.
sys32_dir = os.path.join(os.environ.get("SystemRoot", os.environ.get("windir",r"C:\Windows\system32")),"System32")
if sys32_dir not in normenv['PATH']:
normenv['PATH'] = normenv['PATH'] + os.pathsep + sys32_dir
debug("PATH: %s"%normenv['PATH'])
return normenv return normenv
def get_output(vcbat, args = None, env = None): def get_output(vcbat, args = None, env = None):
"""Parse the output of given bat file, with given args.""" """Parse the output of given bat file, with given args."""
if env is None: if env is None:
# Create a blank environment, for use in launching the tools # Create a blank environment, for use in launching the tools
env = SCons.Environment.Environment(tools=[]) env = SCons.Environment.Environment(tools=[])
@ -136,6 +146,9 @@ def get_output(vcbat, args = None, env = None):
# settings in vs.py. # settings in vs.py.
vars = [ vars = [
'COMSPEC', 'COMSPEC',
# VS100 and VS110: Still set, but modern MSVC setup scripts will
# discard these if registry has values. However Intel compiler setup
# script still requires these as of 2013/2014.
'VS110COMNTOOLS', 'VS110COMNTOOLS',
'VS100COMNTOOLS', 'VS100COMNTOOLS',
'VS90COMNTOOLS', 'VS90COMNTOOLS',
@ -166,6 +179,11 @@ def get_output(vcbat, args = None, env = None):
# and won't work under Pythons not built with threading. # and won't work under Pythons not built with threading.
stdout = popen.stdout.read() stdout = popen.stdout.read()
stderr = popen.stderr.read() stderr = popen.stderr.read()
# Extra debug logic, uncomment if necessar
# debug('get_output():stdout:%s'%stdout)
# debug('get_output():stderr:%s'%stderr)
if stderr: if stderr:
# TODO: find something better to do with stderr; # TODO: find something better to do with stderr;
# this at least prevents errors from getting swallowed. # this at least prevents errors from getting swallowed.
@ -196,7 +214,7 @@ def parse_output(output, keep = ("INCLUDE", "LIB", "LIBPATH", "PATH")):
p = p.encode('mbcs') p = p.encode('mbcs')
# XXX: For some reason, VC98 .bat file adds "" around the PATH # XXX: For some reason, VC98 .bat file adds "" around the PATH
# values, and it screws up the environment later, so we strip # values, and it screws up the environment later, so we strip
# it. # it.
p = p.strip('"') p = p.strip('"')
dkeep[key].append(p) dkeep[key].append(p)

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -20,7 +20,7 @@
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/MSCommon/netframework.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/MSCommon/netframework.py 2014/03/02 14:18:15 garyo"
__doc__ = """ __doc__ = """
""" """

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/MSCommon/sdk.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/MSCommon/sdk.py 2014/03/02 14:18:15 garyo"
__doc__ = """Module to detect the Platform/Windows SDK __doc__ = """Module to detect the Platform/Windows SDK

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@
# * test on 64 bits XP + VS 2005 (and VS 6 if possible) # * test on 64 bits XP + VS 2005 (and VS 6 if possible)
# * SDK # * SDK
# * Assembly # * Assembly
__revision__ = "src/engine/SCons/Tool/MSCommon/vc.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/MSCommon/vc.py 2014/03/02 14:18:15 garyo"
__doc__ = """Module for Visual C/C++ detection and configuration. __doc__ = """Module for Visual C/C++ detection and configuration.
""" """
@ -81,6 +81,7 @@ _ARCH_TO_CANONICAL = {
"itanium" : "ia64", "itanium" : "ia64",
"x86" : "x86", "x86" : "x86",
"x86_64" : "amd64", "x86_64" : "amd64",
"x86_amd64" : "x86_amd64", # Cross compile to 64 bit from 32bits
} }
# Given a (host, target) tuple, return the argument for the bat file. Both host # Given a (host, target) tuple, return the argument for the bat file. Both host
@ -88,6 +89,7 @@ _ARCH_TO_CANONICAL = {
_HOST_TARGET_ARCH_TO_BAT_ARCH = { _HOST_TARGET_ARCH_TO_BAT_ARCH = {
("x86", "x86"): "x86", ("x86", "x86"): "x86",
("x86", "amd64"): "x86_amd64", ("x86", "amd64"): "x86_amd64",
("amd64", "x86_amd64"): "x86_amd64", # This is present in (at least) VS2012 express
("amd64", "amd64"): "amd64", ("amd64", "amd64"): "amd64",
("amd64", "x86"): "x86", ("amd64", "x86"): "x86",
("x86", "ia64"): "x86_ia64" ("x86", "ia64"): "x86_ia64"
@ -256,15 +258,16 @@ def find_batch_file(env,msvc_version,host_arch,target_arch):
installed_sdks=get_installed_sdks() installed_sdks=get_installed_sdks()
for _sdk in installed_sdks: for _sdk in installed_sdks:
sdk_bat_file=_sdk.get_sdk_vc_script(host_arch,target_arch) sdk_bat_file = _sdk.get_sdk_vc_script(host_arch,target_arch)
sdk_bat_file_path=os.path.join(pdir,sdk_bat_file) if not sdk_bat_file:
debug('vc.py:find_batch_file() sdk_bat_file_path:%s'%sdk_bat_file_path) debug("vc.py:find_batch_file() not found:%s"%_sdk)
if os.path.exists(sdk_bat_file_path):
return (batfilename,sdk_bat_file_path)
else: else:
debug("vc.py:find_batch_file() not found:%s"%sdk_bat_file_path) sdk_bat_file_path = os.path.join(pdir,sdk_bat_file)
else: if os.path.exists(sdk_bat_file_path):
return (batfilename,None) debug('vc.py:find_batch_file() sdk_bat_file_path:%s'%sdk_bat_file_path)
return (batfilename,sdk_bat_file_path)
return (batfilename,None)
__INSTALLED_VCS_RUN = None __INSTALLED_VCS_RUN = None
@ -357,13 +360,23 @@ def msvc_find_valid_batch_script(env,version):
# target platform # target platform
(host_platform, target_platform,req_target_platform) = get_host_target(env) (host_platform, target_platform,req_target_platform) = get_host_target(env)
# If the user hasn't specifically requested a TARGET_ARCH, and
# The TARGET_ARCH is amd64 then also try 32 bits if there are no viable
# 64 bit tools installed
try_target_archs = [target_platform] try_target_archs = [target_platform]
if not req_target_platform and target_platform in ('amd64','x86_64'): debug("msvs_find_valid_batch_script(): req_target_platform %s target_platform:%s"%(req_target_platform,target_platform))
# VS2012 has a "cross compile" environment to build 64 bit
# with x86_amd64 as the argument to the batch setup script
if req_target_platform in ('amd64','x86_64'):
try_target_archs.append('x86_amd64')
elif not req_target_platform and target_platform in ['amd64','x86_64']:
# There may not be "native" amd64, but maybe "cross" x86_amd64 tools
try_target_archs.append('x86_amd64')
# If the user hasn't specifically requested a TARGET_ARCH, and
# The TARGET_ARCH is amd64 then also try 32 bits if there are no viable
# 64 bit tools installed
try_target_archs.append('x86') try_target_archs.append('x86')
debug("msvs_find_valid_batch_script(): host_platform: %s try_target_archs:%s"%(host_platform, try_target_archs))
d = None d = None
for tp in try_target_archs: for tp in try_target_archs:
# Set to current arch. # Set to current arch.
@ -399,6 +412,7 @@ def msvc_find_valid_batch_script(env,version):
except BatchFileExecutionError, e: except BatchFileExecutionError, e:
debug('vc.py:msvc_find_valid_batch_script() use_script 3: failed running VC script %s: %s: Error:%s'%(repr(vc_script),arg,e)) debug('vc.py:msvc_find_valid_batch_script() use_script 3: failed running VC script %s: %s: Error:%s'%(repr(vc_script),arg,e))
vc_script=None vc_script=None
continue
if not vc_script and sdk_script: if not vc_script and sdk_script:
debug('vc.py:msvc_find_valid_batch_script() use_script 4: trying sdk script: %s'%(sdk_script)) debug('vc.py:msvc_find_valid_batch_script() use_script 4: trying sdk script: %s'%(sdk_script))
try: try:
@ -409,6 +423,9 @@ def msvc_find_valid_batch_script(env,version):
elif not vc_script and not sdk_script: elif not vc_script and not sdk_script:
debug('vc.py:msvc_find_valid_batch_script() use_script 6: Neither VC script nor SDK script found') debug('vc.py:msvc_find_valid_batch_script() use_script 6: Neither VC script nor SDK script found')
continue continue
debug("vc.py:msvc_find_valid_batch_script() Found a working script/target: %s %s"%(repr(sdk_script),arg))
break # We've found a working target_platform, so stop looking
# If we cannot find a viable installed compiler, reset the TARGET_ARCH # If we cannot find a viable installed compiler, reset the TARGET_ARCH
# To it's initial value # To it's initial value

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -21,7 +21,7 @@
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/MSCommon/vs.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/MSCommon/vs.py 2014/03/02 14:18:15 garyo"
__doc__ = """Module to detect Visual Studio and/or Visual C/C++ __doc__ = """Module to detect Visual Studio and/or Visual C/C++
""" """

View file

@ -8,7 +8,7 @@ selection method.
""" """
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -29,7 +29,7 @@ selection method.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/Perforce.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/Perforce.py 2014/03/02 14:18:15 garyo"
import os import os

View file

@ -7,7 +7,7 @@ Phar Lap ETS tool chain. Right now, this is linkloc and
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -29,7 +29,7 @@ Phar Lap ETS tool chain. Right now, this is linkloc and
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/PharLapCommon.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/PharLapCommon.py 2014/03/02 14:18:15 garyo"
import os import os
import os.path import os.path

View file

@ -8,7 +8,7 @@ selection method.
""" """
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -29,7 +29,7 @@ selection method.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/RCS.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/RCS.py 2014/03/02 14:18:15 garyo"
import SCons.Action import SCons.Action
import SCons.Builder import SCons.Builder

View file

@ -8,7 +8,7 @@ selection method.
""" """
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -29,7 +29,7 @@ selection method.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/SCCS.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/SCCS.py 2014/03/02 14:18:15 garyo"
import SCons.Action import SCons.Action
import SCons.Builder import SCons.Builder

View file

@ -8,7 +8,7 @@ selection method.
""" """
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -29,7 +29,7 @@ selection method.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/Subversion.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/Subversion.py 2014/03/02 14:18:15 garyo"
import os.path import os.path

View file

@ -14,7 +14,7 @@ tool definition.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -35,7 +35,7 @@ tool definition.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/__init__.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/__init__.py 2014/03/02 14:18:15 garyo"
import imp import imp
import sys import sys
@ -257,6 +257,10 @@ def VersionShLibLinkNames(version, libname, env):
print "VersionShLibLinkNames: linkname = ",linkname print "VersionShLibLinkNames: linkname = ",linkname
linknames.append(linkname) linknames.append(linkname)
elif platform == 'posix': elif platform == 'posix':
if sys.platform.startswith('openbsd'):
# OpenBSD uses x.y shared library versioning numbering convention
# and doesn't use symlinks to backwards-compatible libraries
return []
# For libfoo.so.x.y.z, linknames libfoo.so libfoo.so.x.y libfoo.so.x # For libfoo.so.x.y.z, linknames libfoo.so libfoo.so.x.y libfoo.so.x
suffix_re = re.escape(shlib_suffix + '.' + version) suffix_re = re.escape(shlib_suffix + '.' + version)
# First linkname has no version number # First linkname has no version number
@ -302,13 +306,17 @@ symlinks for the platform we are on"""
if version: if version:
# set the shared library link flags # set the shared library link flags
if platform == 'posix': if platform == 'posix':
suffix_re = re.escape(shlib_suffix + '.' + version) shlink_flags += [ '-Wl,-Bsymbolic' ]
(major, age, revision) = version.split(".") # OpenBSD doesn't usually use SONAME for libraries
# soname will have only the major version number in it if not sys.platform.startswith('openbsd'):
soname = re.sub(suffix_re, shlib_suffix, libname) + '.' + major # continue setup of shlink flags for all other POSIX systems
shlink_flags += [ '-Wl,-Bsymbolic', '-Wl,-soname=%s' % soname ] suffix_re = re.escape(shlib_suffix + '.' + version)
if Verbose: (major, age, revision) = version.split(".")
print " soname ",soname,", shlink_flags ",shlink_flags # soname will have only the major version number in it
soname = re.sub(suffix_re, shlib_suffix, libname) + '.' + major
shlink_flags += [ '-Wl,-soname=%s' % soname ]
if Verbose:
print " soname ",soname,", shlink_flags ",shlink_flags
elif platform == 'cygwin': elif platform == 'cygwin':
shlink_flags += [ '-Wl,-Bsymbolic', shlink_flags += [ '-Wl,-Bsymbolic',
'-Wl,--out-implib,${TARGET.base}.a' ] '-Wl,--out-implib,${TARGET.base}.a' ]
@ -337,18 +345,32 @@ symlinks for the platform we are on"""
for count in range(len(linknames)): for count in range(len(linknames)):
linkname = linknames[count] linkname = linknames[count]
if count > 0: if count > 0:
os.symlink(os.path.basename(linkname),lastname) try:
os.remove(lastlinkname)
except:
pass
os.symlink(os.path.basename(linkname),lastlinkname)
if Verbose: if Verbose:
print "VerShLib: made sym link of %s -> %s" % (lastname,linkname) print "VerShLib: made sym link of %s -> %s" % (lastlinkname,linkname)
lastname = linkname lastlinkname = linkname
# finish chain of sym links with link to the actual library # finish chain of sym links with link to the actual library
if len(linknames)>0: if len(linknames)>0:
os.symlink(lib_ver,lastname) try:
os.remove(lastlinkname)
except:
pass
os.symlink(lib_ver,lastlinkname)
if Verbose: if Verbose:
print "VerShLib: made sym link of %s -> %s" % (lib_ver,linkname) print "VerShLib: made sym link of %s -> %s" % (linkname, lib_ver)
return result return result
ShLibAction = SCons.Action.Action(VersionedSharedLibrary, None) # Fix http://scons.tigris.org/issues/show_bug.cgi?id=2903 :
# Ensure we still depend on SCons.Defaults.ShLinkAction command line which is $SHLINKCOM.
# This was tricky because we don't want changing LIBPATH to cause a rebuild, but
# changing other link args should. LIBPATH has $( ... $) around it but until this
# fix, when the varlist was added to the build sig those ignored parts weren't getting
# ignored.
ShLibAction = SCons.Action.Action(VersionedSharedLibrary, None, varlist=['SHLINKCOM'])
def createSharedLibBuilder(env): def createSharedLibBuilder(env):
"""This is a utility function that creates the SharedLibrary """This is a utility function that creates the SharedLibrary
@ -733,6 +755,14 @@ def tool_list(platform, env):
assemblers = ['as'] assemblers = ['as']
fortran_compilers = ['gfortran', 'f95', 'f90', 'g77'] fortran_compilers = ['gfortran', 'f95', 'f90', 'g77']
ars = ['ar'] ars = ['ar']
elif str(platform) == 'cygwin':
"prefer GNU tools on Cygwin, except for a platform-specific linker"
linkers = ['cyglink', 'mslink', 'ilink']
c_compilers = ['gcc', 'msvc', 'intelc', 'icc', 'cc']
cxx_compilers = ['g++', 'msvc', 'intelc', 'icc', 'c++']
assemblers = ['gas', 'nasm', 'masm']
fortran_compilers = ['gfortran', 'g77', 'ifort', 'ifl', 'f95', 'f90', 'f77']
ars = ['ar', 'mslib']
else: else:
"prefer GNU tools on all other platforms" "prefer GNU tools on all other platforms"
linkers = ['gnulink', 'mslink', 'ilink'] linkers = ['gnulink', 'mslink', 'ilink']

View file

@ -9,7 +9,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/aixc++.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/aixc++.py 2014/03/02 14:18:15 garyo"
import os.path import os.path

View file

@ -8,7 +8,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/aixcc.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/aixcc.py 2014/03/02 14:18:15 garyo"
import os.path import os.path

View file

@ -8,7 +8,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/aixf77.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/aixf77.py 2014/03/02 14:18:15 garyo"
import os.path import os.path

View file

@ -8,7 +8,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/aixlink.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/aixlink.py 2014/03/02 14:18:15 garyo"
import os import os
import os.path import os.path

View file

@ -9,7 +9,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/applelink.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/applelink.py 2014/03/02 14:18:15 garyo"
import SCons.Util import SCons.Util

View file

@ -9,7 +9,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/ar.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/ar.py 2014/03/02 14:18:15 garyo"
import SCons.Defaults import SCons.Defaults
import SCons.Tool import SCons.Tool

View file

@ -9,7 +9,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/as.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/as.py 2014/03/02 14:18:15 garyo"
import SCons.Defaults import SCons.Defaults
import SCons.Tool import SCons.Tool

View file

@ -5,7 +5,7 @@ XXX
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -27,7 +27,7 @@ XXX
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/bcc32.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/bcc32.py 2014/03/02 14:18:15 garyo"
import os import os
import os.path import os.path

View file

@ -8,7 +8,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/c++.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/c++.py 2014/03/02 14:18:15 garyo"
import os.path import os.path

View file

@ -8,7 +8,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/cc.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/cc.py 2014/03/02 14:18:15 garyo"
import SCons.Tool import SCons.Tool
import SCons.Defaults import SCons.Defaults

View file

@ -5,7 +5,7 @@ Tool-specific initialization for the Compaq Visual Fortran compiler.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -27,7 +27,7 @@ Tool-specific initialization for the Compaq Visual Fortran compiler.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/cvf.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/cvf.py 2014/03/02 14:18:15 garyo"
import fortran import fortran

View file

@ -0,0 +1,94 @@
"""SCons.Tool.cyglink
Customization of gnulink for Cygwin (http://www.cygwin.com/)
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
import SCons.Action
import SCons.Util
import gnulink
def shlib_generator(target, source, env, for_signature):
cmd = SCons.Util.CLVar(['$SHLINK'])
dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX')
if dll: cmd.extend(['-o', dll])
cmd.extend(['$SHLINKFLAGS', '$__RPATH'])
implib = env.FindIxes(target, 'IMPLIBPREFIX', 'IMPLIBSUFFIX')
if implib:
cmd.extend([
'-Wl,--out-implib='+implib.get_string(for_signature),
'-Wl,--export-all-symbols',
'-Wl,--enable-auto-import',
'-Wl,--whole-archive', '$SOURCES',
'-Wl,--no-whole-archive', '$_LIBDIRFLAGS', '$_LIBFLAGS'
])
else:
cmd.extend(['$SOURCES', '$_LIBDIRFLAGS', '$_LIBFLAGS'])
return [cmd]
def shlib_emitter(target, source, env):
dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX')
no_import_lib = env.get('no_import_lib', 0)
if not dll or len(target) > 1:
raise SCons.Errors.UserError("A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX"))
# Remove any "lib" after the prefix
pre = env.subst('$SHLIBPREFIX')
if dll.name[len(pre):len(pre)+3] == 'lib':
dll.name = pre + dll.name[len(pre)+3:]
orig_target = target
target = [env.fs.File(dll)]
target[0].attributes.shared = 1
# Append an import lib target
if not no_import_lib:
# Create list of target libraries as strings
target_strings = env.ReplaceIxes(orig_target[0],
'SHLIBPREFIX', 'SHLIBSUFFIX',
'IMPLIBPREFIX', 'IMPLIBSUFFIX')
implib_target = env.fs.File(target_strings)
implib_target.attributes.shared = 1
target.append(implib_target)
return (target, source)
shlib_action = SCons.Action.Action(shlib_generator, generator=1)
def generate(env):
"""Add Builders and construction variables for cyglink to an Environment."""
gnulink.generate(env)
env['LINKFLAGS'] = SCons.Util.CLVar('-Wl,-no-undefined')
env['SHLINKCOM'] = shlib_action
env['LDMODULECOM'] = shlib_action
env.Append(SHLIBEMITTER = [shlib_emitter])
env['SHLIBPREFIX'] = 'cyg'
env['SHLIBSUFFIX'] = '.dll'
env['IMPLIBPREFIX'] = 'lib'
env['IMPLIBSUFFIX'] = '.dll.a'
def exists(env):
return gnulink.exists(env)
# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:

View file

@ -9,7 +9,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/default.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/default.py 2014/03/02 14:18:15 garyo"
import SCons.Tool import SCons.Tool

View file

@ -35,7 +35,7 @@ Lib tool variables:
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -57,7 +57,7 @@ Lib tool variables:
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/dmd.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/dmd.py 2014/03/02 14:18:15 garyo"
import os import os

View file

@ -0,0 +1,877 @@
"""SCons.Tool.docbook
Tool-specific initialization for Docbook.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001-7,2010 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
import os
import glob
import re
import SCons.Action
import SCons.Builder
import SCons.Defaults
import SCons.Script
import SCons.Tool
import SCons.Util
# Get full path to this script
scriptpath = os.path.dirname(os.path.realpath(__file__))
# Local folder for the collection of DocBook XSLs
db_xsl_folder = 'docbook-xsl-1.76.1'
# Do we have libxml2/libxslt/lxml?
has_libxml2 = True
has_lxml = True
try:
import libxml2
import libxslt
except:
has_libxml2 = False
try:
import lxml
except:
has_lxml = False
# Set this to True, to prefer xsltproc over libxml2 and lxml
prefer_xsltproc = False
# Regexs for parsing Docbook XML sources of MAN pages
re_manvolnum = re.compile("<manvolnum>([^<]*)</manvolnum>")
re_refname = re.compile("<refname>([^<]*)</refname>")
#
# Helper functions
#
def __extend_targets_sources(target, source):
""" Prepare the lists of target and source files. """
if not SCons.Util.is_List(target):
target = [target]
if not source:
source = target[:]
elif not SCons.Util.is_List(source):
source = [source]
if len(target) < len(source):
target.extend(source[len(target):])
return target, source
def __init_xsl_stylesheet(kw, env, user_xsl_var, default_path):
if kw.get('DOCBOOK_XSL','') == '':
xsl_style = kw.get('xsl', env.subst(user_xsl_var))
if xsl_style == '':
path_args = [scriptpath, db_xsl_folder] + default_path
xsl_style = os.path.join(*path_args)
kw['DOCBOOK_XSL'] = xsl_style
def __select_builder(lxml_builder, libxml2_builder, cmdline_builder):
""" Selects a builder, based on which Python modules are present. """
if prefer_xsltproc:
return cmdline_builder
if not has_libxml2:
# At the moment we prefer libxml2 over lxml, the latter can lead
# to conflicts when installed together with libxml2.
if has_lxml:
return lxml_builder
else:
return cmdline_builder
return libxml2_builder
def __ensure_suffix(t, suffix):
""" Ensure that the target t has the given suffix. """
tpath = str(t)
if not tpath.endswith(suffix):
return tpath+suffix
return t
def __ensure_suffix_stem(t, suffix):
""" Ensure that the target t has the given suffix, and return the file's stem. """
tpath = str(t)
if not tpath.endswith(suffix):
stem = tpath
tpath += suffix
return tpath, stem
else:
stem, ext = os.path.splitext(tpath)
return t, stem
def __get_xml_text(root):
""" Return the text for the given root node (xml.dom.minidom). """
txt = ""
for e in root.childNodes:
if (e.nodeType == e.TEXT_NODE):
txt += e.data
return txt
def __create_output_dir(base_dir):
""" Ensure that the output directory base_dir exists. """
root, tail = os.path.split(base_dir)
dir = None
if tail:
if base_dir.endswith('/'):
dir = base_dir
else:
dir = root
else:
if base_dir.endswith('/'):
dir = base_dir
if dir and not os.path.isdir(dir):
os.makedirs(dir)
#
# Supported command line tools and their call "signature"
#
xsltproc_com = {'xsltproc' : '$DOCBOOK_XSLTPROC $DOCBOOK_XSLTPROCFLAGS -o $TARGET $DOCBOOK_XSL $SOURCE',
'saxon' : '$DOCBOOK_XSLTPROC $DOCBOOK_XSLTPROCFLAGS -o $TARGET $DOCBOOK_XSL $SOURCE $DOCBOOK_XSLTPROCPARAMS',
'saxon-xslt' : '$DOCBOOK_XSLTPROC $DOCBOOK_XSLTPROCFLAGS -o $TARGET $DOCBOOK_XSL $SOURCE $DOCBOOK_XSLTPROCPARAMS',
'xalan' : '$DOCBOOK_XSLTPROC $DOCBOOK_XSLTPROCFLAGS -q -out $TARGET -xsl $DOCBOOK_XSL -in $SOURCE'}
xmllint_com = {'xmllint' : '$DOCBOOK_XMLLINT $DOCBOOK_XMLLINTFLAGS --xinclude $SOURCE > $TARGET'}
fop_com = {'fop' : '$DOCBOOK_FOP $DOCBOOK_FOPFLAGS -fo $SOURCE -pdf $TARGET',
'xep' : '$DOCBOOK_FOP $DOCBOOK_FOPFLAGS -valid -fo $SOURCE -pdf $TARGET',
'jw' : '$DOCBOOK_FOP $DOCBOOK_FOPFLAGS -f docbook -b pdf $SOURCE -o $TARGET'}
def __detect_cl_tool(env, chainkey, cdict):
"""
Helper function, picks a command line tool from the list
and initializes its environment variables.
"""
if env.get(chainkey,'') == '':
clpath = ''
for cltool in cdict:
clpath = env.WhereIs(cltool)
if clpath:
env[chainkey] = clpath
if not env[chainkey + 'COM']:
env[chainkey + 'COM'] = cdict[cltool]
def _detect(env):
"""
Detect all the command line tools that we might need for creating
the requested output formats.
"""
global prefer_xsltproc
if env.get('DOCBOOK_PREFER_XSLTPROC',''):
prefer_xsltproc = True
if ((not has_libxml2 and not has_lxml) or (prefer_xsltproc)):
# Try to find the XSLT processors
__detect_cl_tool(env, 'DOCBOOK_XSLTPROC', xsltproc_com)
__detect_cl_tool(env, 'DOCBOOK_XMLLINT', xmllint_com)
__detect_cl_tool(env, 'DOCBOOK_FOP', fop_com)
#
# Scanners
#
include_re = re.compile('fileref\\s*=\\s*["|\']([^\\n]*)["|\']')
sentity_re = re.compile('<!ENTITY\\s+%*\\s*[^\\s]+\\s+SYSTEM\\s+["|\']([^\\n]*)["|\']>')
def __xml_scan(node, env, path, arg):
""" Simple XML file scanner, detecting local images and XIncludes as implicit dependencies. """
# Does the node exist yet?
if not os.path.isfile(str(node)):
return []
if env.get('DOCBOOK_SCANENT',''):
# Use simple pattern matching for system entities..., no support
# for recursion yet.
contents = node.get_text_contents()
return sentity_re.findall(contents)
xsl_file = os.path.join(scriptpath,'utils','xmldepend.xsl')
if not has_libxml2 or prefer_xsltproc:
if has_lxml and not prefer_xsltproc:
from lxml import etree
xsl_tree = etree.parse(xsl_file)
doc = etree.parse(str(node))
result = doc.xslt(xsl_tree)
depfiles = [x.strip() for x in str(result).splitlines() if x.strip() != "" and not x.startswith("<?xml ")]
return depfiles
else:
# Try to call xsltproc
xsltproc = env.subst("$DOCBOOK_XSLTPROC")
if xsltproc and xsltproc.endswith('xsltproc'):
result = env.backtick(' '.join([xsltproc, xsl_file, str(node)]))
depfiles = [x.strip() for x in str(result).splitlines() if x.strip() != "" and not x.startswith("<?xml ")]
return depfiles
else:
# Use simple pattern matching, there is currently no support
# for xi:includes...
contents = node.get_text_contents()
return include_re.findall(contents)
styledoc = libxml2.parseFile(xsl_file)
style = libxslt.parseStylesheetDoc(styledoc)
doc = libxml2.parseFile(str(node))
result = style.applyStylesheet(doc, None)
depfiles = []
for x in str(result).splitlines():
if x.strip() != "" and not x.startswith("<?xml "):
depfiles.extend(x.strip().split())
style.freeStylesheet()
doc.freeDoc()
result.freeDoc()
return depfiles
# Creating the instance of our XML dependency scanner
docbook_xml_scanner = SCons.Script.Scanner(function = __xml_scan,
argument = None)
#
# Action generators
#
def __generate_xsltproc_action(source, target, env, for_signature):
cmd = env['DOCBOOK_XSLTPROCCOM']
# Does the environment have a base_dir defined?
base_dir = env.subst('$base_dir')
if base_dir:
# Yes, so replace target path by its filename
return cmd.replace('$TARGET','${TARGET.file}')
return cmd
#
# Emitters
#
def __emit_xsl_basedir(target, source, env):
# Does the environment have a base_dir defined?
base_dir = env.subst('$base_dir')
if base_dir:
# Yes, so prepend it to each target
return [os.path.join(base_dir, str(t)) for t in target], source
# No, so simply pass target and source names through
return target, source
#
# Builders
#
def __build_libxml2(target, source, env):
"""
General XSLT builder (HTML/FO), using the libxml2 module.
"""
xsl_style = env.subst('$DOCBOOK_XSL')
styledoc = libxml2.parseFile(xsl_style)
style = libxslt.parseStylesheetDoc(styledoc)
doc = libxml2.readFile(str(source[0]),None,libxml2.XML_PARSE_NOENT)
# Support for additional parameters
parampass = {}
if parampass:
result = style.applyStylesheet(doc, parampass)
else:
result = style.applyStylesheet(doc, None)
style.saveResultToFilename(str(target[0]), result, 0)
style.freeStylesheet()
doc.freeDoc()
result.freeDoc()
return None
def __build_lxml(target, source, env):
"""
General XSLT builder (HTML/FO), using the lxml module.
"""
from lxml import etree
xslt_ac = etree.XSLTAccessControl(read_file=True,
write_file=True,
create_dir=True,
read_network=False,
write_network=False)
xsl_style = env.subst('$DOCBOOK_XSL')
xsl_tree = etree.parse(xsl_style)
transform = etree.XSLT(xsl_tree, access_control=xslt_ac)
doc = etree.parse(str(source[0]))
# Support for additional parameters
parampass = {}
if parampass:
result = transform(doc, **parampass)
else:
result = transform(doc)
try:
of = open(str(target[0]), "w")
of.write(of.write(etree.tostring(result, pretty_print=True)))
of.close()
except:
pass
return None
def __xinclude_libxml2(target, source, env):
"""
Resolving XIncludes, using the libxml2 module.
"""
doc = libxml2.readFile(str(source[0]), None, libxml2.XML_PARSE_NOENT)
doc.xincludeProcess()
doc.saveFile(str(target[0]))
doc.freeDoc()
return None
def __xinclude_lxml(target, source, env):
"""
Resolving XIncludes, using the lxml module.
"""
from lxml import etree
doc = etree.parse(str(source[0]))
doc.xinclude()
try:
doc.write(str(target[0]), xml_declaration=True,
encoding="UTF-8", pretty_print=True)
except:
pass
return None
__libxml2_builder = SCons.Builder.Builder(
action = __build_libxml2,
src_suffix = '.xml',
source_scanner = docbook_xml_scanner,
emitter = __emit_xsl_basedir)
__lxml_builder = SCons.Builder.Builder(
action = __build_lxml,
src_suffix = '.xml',
source_scanner = docbook_xml_scanner,
emitter = __emit_xsl_basedir)
__xinclude_libxml2_builder = SCons.Builder.Builder(
action = __xinclude_libxml2,
suffix = '.xml',
src_suffix = '.xml',
source_scanner = docbook_xml_scanner)
__xinclude_lxml_builder = SCons.Builder.Builder(
action = __xinclude_lxml,
suffix = '.xml',
src_suffix = '.xml',
source_scanner = docbook_xml_scanner)
__xsltproc_builder = SCons.Builder.Builder(
action = SCons.Action.CommandGeneratorAction(__generate_xsltproc_action,
{'cmdstr' : '$DOCBOOK_XSLTPROCCOMSTR'}),
src_suffix = '.xml',
source_scanner = docbook_xml_scanner,
emitter = __emit_xsl_basedir)
__xmllint_builder = SCons.Builder.Builder(
action = SCons.Action.Action('$DOCBOOK_XMLLINTCOM','$DOCBOOK_XMLLINTCOMSTR'),
suffix = '.xml',
src_suffix = '.xml',
source_scanner = docbook_xml_scanner)
__fop_builder = SCons.Builder.Builder(
action = SCons.Action.Action('$DOCBOOK_FOPCOM','$DOCBOOK_FOPCOMSTR'),
suffix = '.pdf',
src_suffix = '.fo',
ensure_suffix=1)
def DocbookEpub(env, target, source=None, *args, **kw):
"""
A pseudo-Builder, providing a Docbook toolchain for ePub output.
"""
import zipfile
import shutil
def build_open_container(target, source, env):
"""Generate the *.epub file from intermediate outputs
Constructs the epub file according to the Open Container Format. This
function could be replaced by a call to the SCons Zip builder if support
was added for different compression formats for separate source nodes.
"""
zf = zipfile.ZipFile(str(target[0]), 'w')
mime_file = open('mimetype', 'w')
mime_file.write('application/epub+zip')
mime_file.close()
zf.write(mime_file.name, compress_type = zipfile.ZIP_STORED)
for s in source:
for dirpath, dirnames, filenames in os.walk(str(s)):
for fname in filenames:
path = os.path.join(dirpath, fname)
if os.path.isfile(path):
zf.write(path, os.path.relpath(path, str(env.get('ZIPROOT', ''))),
zipfile.ZIP_DEFLATED)
zf.close()
def add_resources(target, source, env):
"""Add missing resources to the OEBPS directory
Ensure all the resources in the manifest are present in the OEBPS directory.
"""
hrefs = []
content_file = os.path.join(source[0].abspath, 'content.opf')
if not os.path.isfile(content_file):
return
hrefs = []
if has_libxml2:
nsmap = {'opf' : 'http://www.idpf.org/2007/opf'}
# Read file and resolve entities
doc = libxml2.readFile(content_file, None, 0)
opf = doc.getRootElement()
# Create xpath context
xpath_context = doc.xpathNewContext()
# Register namespaces
for key, val in nsmap.iteritems():
xpath_context.xpathRegisterNs(key, val)
if hasattr(opf, 'xpathEval') and xpath_context:
# Use the xpath context
xpath_context.setContextNode(opf)
items = xpath_context.xpathEval(".//opf:item")
else:
items = opf.findall(".//{'http://www.idpf.org/2007/opf'}item")
for item in items:
if hasattr(item, 'prop'):
hrefs.append(item.prop('href'))
else:
hrefs.append(item.attrib['href'])
doc.freeDoc()
xpath_context.xpathFreeContext()
elif has_lxml:
from lxml import etree
opf = etree.parse(content_file)
# All the opf:item elements are resources
for item in opf.xpath('//opf:item',
namespaces= { 'opf': 'http://www.idpf.org/2007/opf' }):
hrefs.append(item.attrib['href'])
for href in hrefs:
# If the resource was not already created by DocBook XSL itself,
# copy it into the OEBPS folder
referenced_file = os.path.join(source[0].abspath, href)
if not os.path.exists(referenced_file):
shutil.copy(href, os.path.join(source[0].abspath, href))
# Init list of targets/sources
target, source = __extend_targets_sources(target, source)
# Init XSL stylesheet
__init_xsl_stylesheet(kw, env, '$DOCBOOK_DEFAULT_XSL_EPUB', ['epub','docbook.xsl'])
# Setup builder
__builder = __select_builder(__lxml_builder, __libxml2_builder, __xsltproc_builder)
# Create targets
result = []
if not env.GetOption('clean'):
# Ensure that the folders OEBPS and META-INF exist
__create_output_dir('OEBPS/')
__create_output_dir('META-INF/')
dirs = env.Dir(['OEBPS', 'META-INF'])
# Set the fixed base_dir
kw['base_dir'] = 'OEBPS/'
tocncx = __builder.__call__(env, 'toc.ncx', source[0], **kw)
cxml = env.File('META-INF/container.xml')
env.SideEffect(cxml, tocncx)
env.Depends(tocncx, kw['DOCBOOK_XSL'])
result.extend(tocncx+[cxml])
container = env.Command(__ensure_suffix(str(target[0]), '.epub'),
tocncx+[cxml], [add_resources, build_open_container])
mimetype = env.File('mimetype')
env.SideEffect(mimetype, container)
result.extend(container)
# Add supporting files for cleanup
env.Clean(tocncx, dirs)
return result
def DocbookHtml(env, target, source=None, *args, **kw):
"""
A pseudo-Builder, providing a Docbook toolchain for HTML output.
"""
# Init list of targets/sources
target, source = __extend_targets_sources(target, source)
# Init XSL stylesheet
__init_xsl_stylesheet(kw, env, '$DOCBOOK_DEFAULT_XSL_HTML', ['html','docbook.xsl'])
# Setup builder
__builder = __select_builder(__lxml_builder, __libxml2_builder, __xsltproc_builder)
# Create targets
result = []
for t,s in zip(target,source):
r = __builder.__call__(env, __ensure_suffix(t,'.html'), s, **kw)
env.Depends(r, kw['DOCBOOK_XSL'])
result.extend(r)
return result
def DocbookHtmlChunked(env, target, source=None, *args, **kw):
"""
A pseudo-Builder, providing a Docbook toolchain for chunked HTML output.
"""
# Init target/source
if not SCons.Util.is_List(target):
target = [target]
if not source:
source = target
target = ['index.html']
elif not SCons.Util.is_List(source):
source = [source]
# Init XSL stylesheet
__init_xsl_stylesheet(kw, env, '$DOCBOOK_DEFAULT_XSL_HTMLCHUNKED', ['html','chunkfast.xsl'])
# Setup builder
__builder = __select_builder(__lxml_builder, __libxml2_builder, __xsltproc_builder)
# Detect base dir
base_dir = kw.get('base_dir', '')
if base_dir:
__create_output_dir(base_dir)
# Create targets
result = []
r = __builder.__call__(env, __ensure_suffix(str(target[0]), '.html'), source[0], **kw)
env.Depends(r, kw['DOCBOOK_XSL'])
result.extend(r)
# Add supporting files for cleanup
env.Clean(r, glob.glob(os.path.join(base_dir, '*.html')))
return result
def DocbookHtmlhelp(env, target, source=None, *args, **kw):
"""
A pseudo-Builder, providing a Docbook toolchain for HTMLHELP output.
"""
# Init target/source
if not SCons.Util.is_List(target):
target = [target]
if not source:
source = target
target = ['index.html']
elif not SCons.Util.is_List(source):
source = [source]
# Init XSL stylesheet
__init_xsl_stylesheet(kw, env, '$DOCBOOK_DEFAULT_XSL_HTMLHELP', ['htmlhelp','htmlhelp.xsl'])
# Setup builder
__builder = __select_builder(__lxml_builder, __libxml2_builder, __xsltproc_builder)
# Detect base dir
base_dir = kw.get('base_dir', '')
if base_dir:
__create_output_dir(base_dir)
# Create targets
result = []
r = __builder.__call__(env, __ensure_suffix(str(target[0]), '.html'), source[0], **kw)
env.Depends(r, kw['DOCBOOK_XSL'])
result.extend(r)
# Add supporting files for cleanup
env.Clean(r, ['toc.hhc', 'htmlhelp.hhp', 'index.hhk'] +
glob.glob(os.path.join(base_dir, '[ar|bk|ch]*.html')))
return result
def DocbookPdf(env, target, source=None, *args, **kw):
"""
A pseudo-Builder, providing a Docbook toolchain for PDF output.
"""
# Init list of targets/sources
target, source = __extend_targets_sources(target, source)
# Init XSL stylesheet
__init_xsl_stylesheet(kw, env, '$DOCBOOK_DEFAULT_XSL_PDF', ['fo','docbook.xsl'])
# Setup builder
__builder = __select_builder(__lxml_builder, __libxml2_builder, __xsltproc_builder)
# Create targets
result = []
for t,s in zip(target,source):
t, stem = __ensure_suffix_stem(t, '.pdf')
xsl = __builder.__call__(env, stem+'.fo', s, **kw)
result.extend(xsl)
env.Depends(xsl, kw['DOCBOOK_XSL'])
result.extend(__fop_builder.__call__(env, t, xsl, **kw))
return result
def DocbookMan(env, target, source=None, *args, **kw):
"""
A pseudo-Builder, providing a Docbook toolchain for Man page output.
"""
# Init list of targets/sources
target, source = __extend_targets_sources(target, source)
# Init XSL stylesheet
__init_xsl_stylesheet(kw, env, '$DOCBOOK_DEFAULT_XSL_MAN', ['manpages','docbook.xsl'])
# Setup builder
__builder = __select_builder(__lxml_builder, __libxml2_builder, __xsltproc_builder)
# Create targets
result = []
for t,s in zip(target,source):
volnum = "1"
outfiles = []
srcfile = __ensure_suffix(str(s),'.xml')
if os.path.isfile(srcfile):
try:
import xml.dom.minidom
dom = xml.dom.minidom.parse(__ensure_suffix(str(s),'.xml'))
# Extract volume number, default is 1
for node in dom.getElementsByTagName('refmeta'):
for vol in node.getElementsByTagName('manvolnum'):
volnum = __get_xml_text(vol)
# Extract output filenames
for node in dom.getElementsByTagName('refnamediv'):
for ref in node.getElementsByTagName('refname'):
outfiles.append(__get_xml_text(ref)+'.'+volnum)
except:
# Use simple regex parsing
f = open(__ensure_suffix(str(s),'.xml'), 'r')
content = f.read()
f.close()
for m in re_manvolnum.finditer(content):
volnum = m.group(1)
for m in re_refname.finditer(content):
outfiles.append(m.group(1)+'.'+volnum)
if not outfiles:
# Use stem of the source file
spath = str(s)
if not spath.endswith('.xml'):
outfiles.append(spath+'.'+volnum)
else:
stem, ext = os.path.splitext(spath)
outfiles.append(stem+'.'+volnum)
else:
# We have to completely rely on the given target name
outfiles.append(t)
__builder.__call__(env, outfiles[0], s, **kw)
env.Depends(outfiles[0], kw['DOCBOOK_XSL'])
result.append(outfiles[0])
if len(outfiles) > 1:
env.Clean(outfiles[0], outfiles[1:])
return result
def DocbookSlidesPdf(env, target, source=None, *args, **kw):
"""
A pseudo-Builder, providing a Docbook toolchain for PDF slides output.
"""
# Init list of targets/sources
target, source = __extend_targets_sources(target, source)
# Init XSL stylesheet
__init_xsl_stylesheet(kw, env, '$DOCBOOK_DEFAULT_XSL_SLIDESPDF', ['slides','fo','plain.xsl'])
# Setup builder
__builder = __select_builder(__lxml_builder, __libxml2_builder, __xsltproc_builder)
# Create targets
result = []
for t,s in zip(target,source):
t, stem = __ensure_suffix_stem(t, '.pdf')
xsl = __builder.__call__(env, stem+'.fo', s, **kw)
env.Depends(xsl, kw['DOCBOOK_XSL'])
result.extend(xsl)
result.extend(__fop_builder.__call__(env, t, xsl, **kw))
return result
def DocbookSlidesHtml(env, target, source=None, *args, **kw):
"""
A pseudo-Builder, providing a Docbook toolchain for HTML slides output.
"""
# Init list of targets/sources
if not SCons.Util.is_List(target):
target = [target]
if not source:
source = target
target = ['index.html']
elif not SCons.Util.is_List(source):
source = [source]
# Init XSL stylesheet
__init_xsl_stylesheet(kw, env, '$DOCBOOK_DEFAULT_XSL_SLIDESHTML', ['slides','html','plain.xsl'])
# Setup builder
__builder = __select_builder(__lxml_builder, __libxml2_builder, __xsltproc_builder)
# Detect base dir
base_dir = kw.get('base_dir', '')
if base_dir:
__create_output_dir(base_dir)
# Create targets
result = []
r = __builder.__call__(env, __ensure_suffix(str(target[0]), '.html'), source[0], **kw)
env.Depends(r, kw['DOCBOOK_XSL'])
result.extend(r)
# Add supporting files for cleanup
env.Clean(r, [os.path.join(base_dir, 'toc.html')] +
glob.glob(os.path.join(base_dir, 'foil*.html')))
return result
def DocbookXInclude(env, target, source, *args, **kw):
"""
A pseudo-Builder, for resolving XIncludes in a separate processing step.
"""
# Init list of targets/sources
target, source = __extend_targets_sources(target, source)
# Setup builder
__builder = __select_builder(__xinclude_lxml_builder,__xinclude_libxml2_builder,__xmllint_builder)
# Create targets
result = []
for t,s in zip(target,source):
result.extend(__builder.__call__(env, t, s, **kw))
return result
def DocbookXslt(env, target, source=None, *args, **kw):
"""
A pseudo-Builder, applying a simple XSL transformation to the input file.
"""
# Init list of targets/sources
target, source = __extend_targets_sources(target, source)
# Init XSL stylesheet
kw['DOCBOOK_XSL'] = kw.get('xsl', 'transform.xsl')
# Setup builder
__builder = __select_builder(__lxml_builder, __libxml2_builder, __xsltproc_builder)
# Create targets
result = []
for t,s in zip(target,source):
r = __builder.__call__(env, t, s, **kw)
env.Depends(r, kw['DOCBOOK_XSL'])
result.extend(r)
return result
def generate(env):
"""Add Builders and construction variables for docbook to an Environment."""
env.SetDefault(
# Default names for customized XSL stylesheets
DOCBOOK_DEFAULT_XSL_EPUB = '',
DOCBOOK_DEFAULT_XSL_HTML = '',
DOCBOOK_DEFAULT_XSL_HTMLCHUNKED = '',
DOCBOOK_DEFAULT_XSL_HTMLHELP = '',
DOCBOOK_DEFAULT_XSL_PDF = '',
DOCBOOK_DEFAULT_XSL_MAN = '',
DOCBOOK_DEFAULT_XSL_SLIDESPDF = '',
DOCBOOK_DEFAULT_XSL_SLIDESHTML = '',
# Paths to the detected executables
DOCBOOK_XSLTPROC = '',
DOCBOOK_XMLLINT = '',
DOCBOOK_FOP = '',
# Additional flags for the text processors
DOCBOOK_XSLTPROCFLAGS = SCons.Util.CLVar(''),
DOCBOOK_XMLLINTFLAGS = SCons.Util.CLVar(''),
DOCBOOK_FOPFLAGS = SCons.Util.CLVar(''),
DOCBOOK_XSLTPROCPARAMS = SCons.Util.CLVar(''),
# Default command lines for the detected executables
DOCBOOK_XSLTPROCCOM = xsltproc_com['xsltproc'],
DOCBOOK_XMLLINTCOM = xmllint_com['xmllint'],
DOCBOOK_FOPCOM = fop_com['fop'],
# Screen output for the text processors
DOCBOOK_XSLTPROCCOMSTR = None,
DOCBOOK_XMLLINTCOMSTR = None,
DOCBOOK_FOPCOMSTR = None,
)
_detect(env)
try:
env.AddMethod(DocbookEpub, "DocbookEpub")
env.AddMethod(DocbookHtml, "DocbookHtml")
env.AddMethod(DocbookHtmlChunked, "DocbookHtmlChunked")
env.AddMethod(DocbookHtmlhelp, "DocbookHtmlhelp")
env.AddMethod(DocbookPdf, "DocbookPdf")
env.AddMethod(DocbookMan, "DocbookMan")
env.AddMethod(DocbookSlidesPdf, "DocbookSlidesPdf")
env.AddMethod(DocbookSlidesHtml, "DocbookSlidesHtml")
env.AddMethod(DocbookXInclude, "DocbookXInclude")
env.AddMethod(DocbookXslt, "DocbookXslt")
except AttributeError:
# Looks like we use a pre-0.98 version of SCons...
from SCons.Script.SConscript import SConsEnvironment
SConsEnvironment.DocbookEpub = DocbookEpub
SConsEnvironment.DocbookHtml = DocbookHtml
SConsEnvironment.DocbookHtmlChunked = DocbookHtmlChunked
SConsEnvironment.DocbookHtmlhelp = DocbookHtmlhelp
SConsEnvironment.DocbookPdf = DocbookPdf
SConsEnvironment.DocbookMan = DocbookMan
SConsEnvironment.DocbookSlidesPdf = DocbookSlidesPdf
SConsEnvironment.DocbookSlidesHtml = DocbookSlidesHtml
SConsEnvironment.DocbookXInclude = DocbookXInclude
SConsEnvironment.DocbookXslt = DocbookXslt
def exists(env):
return 1

View file

@ -5,7 +5,7 @@ Common DVI Builder definition for various other Tool modules that use it.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -27,7 +27,7 @@ Common DVI Builder definition for various other Tool modules that use it.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/dvi.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/dvi.py 2014/03/02 14:18:15 garyo"
import SCons.Builder import SCons.Builder
import SCons.Tool import SCons.Tool

View file

@ -9,7 +9,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ selection method.
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
__revision__ = "src/engine/SCons/Tool/dvipdf.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/dvipdf.py 2014/03/02 14:18:15 garyo"
import SCons.Action import SCons.Action
import SCons.Defaults import SCons.Defaults

View file

@ -9,7 +9,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/dvips.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/dvips.py 2014/03/02 14:18:15 garyo"
import SCons.Action import SCons.Action
import SCons.Builder import SCons.Builder

View file

@ -9,7 +9,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/f03.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/f03.py 2014/03/02 14:18:15 garyo"
import SCons.Defaults import SCons.Defaults
import SCons.Tool import SCons.Tool

View file

@ -9,7 +9,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/f77.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/f77.py 2014/03/02 14:18:15 garyo"
import SCons.Defaults import SCons.Defaults
import SCons.Scanner.Fortran import SCons.Scanner.Fortran

View file

@ -9,7 +9,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/f90.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/f90.py 2014/03/02 14:18:15 garyo"
import SCons.Defaults import SCons.Defaults
import SCons.Scanner.Fortran import SCons.Scanner.Fortran

View file

@ -9,7 +9,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/f95.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/f95.py 2014/03/02 14:18:15 garyo"
import SCons.Defaults import SCons.Defaults
import SCons.Tool import SCons.Tool

View file

@ -8,7 +8,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -30,7 +30,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/filesystem.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/filesystem.py 2014/03/02 14:18:15 garyo"
import SCons import SCons
from SCons.Tool.install import copyFunc from SCons.Tool.install import copyFunc

View file

@ -9,7 +9,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/fortran.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/fortran.py 2014/03/02 14:18:15 garyo"
import re import re

View file

@ -9,7 +9,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/g++.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/g++.py 2014/03/02 14:18:15 garyo"
import os.path import os.path
import re import re

View file

@ -9,7 +9,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/g77.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/g77.py 2014/03/02 14:18:15 garyo"
import SCons.Util import SCons.Util
from SCons.Tool.FortranCommon import add_all_to_env, add_f77_to_env from SCons.Tool.FortranCommon import add_all_to_env, add_f77_to_env

View file

@ -9,7 +9,7 @@ selection method.
""" """
# #
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 The SCons Foundation # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 The SCons Foundation
# #
# Permission is hereby granted, free of charge, to any person obtaining # Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the # a copy of this software and associated documentation files (the
@ -31,7 +31,7 @@ selection method.
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# #
__revision__ = "src/engine/SCons/Tool/gas.py 2013/03/03 09:48:35 garyo" __revision__ = "src/engine/SCons/Tool/gas.py 2014/03/02 14:18:15 garyo"
as_module = __import__('as', globals(), locals(), []) as_module = __import__('as', globals(), locals(), [])

Some files were not shown because too many files have changed in this diff Show more