Example #1
0
    def __init__(self, builder, cmdgen):
        if __debug__: logInstanceCreation(self, 'Builder.CompositeBuilder')
        SCons.Util.Proxy.__init__(self, builder)

        # cmdgen should always be an instance of DictCmdGenerator.
        self.cmdgen = cmdgen
        self.builder = builder
Example #2
0
    def __init__(self, builder, cmdgen):
        if SCons.Debug.track_instances: logInstanceCreation(self, 'Builder.CompositeBuilder')
        SCons.Util.Proxy.__init__(self, builder)

        # cmdgen should always be an instance of DictCmdGenerator.
        self.cmdgen = cmdgen
        self.builder = builder
Example #3
0
 def __init__(self, var, kw):
     if SCons.Debug.track_instances:
         logInstanceCreation(self, 'Action.LazyAction')
     #FUTURE CommandAction.__init__(self, '${'+var+'}', **kw)
     CommandAction.__init__(self, '${' + var + '}', **kw)
     self.var = SCons.Util.to_String(var)
     self.gen_kw = kw
Example #4
0
 def __init__(self, var, kw):
     if __debug__:
         logInstanceCreation(self, "Action.LazyAction")
     # FUTURE CommandAction.__init__(self, '${'+var+'}', **kw)
     apply(CommandAction.__init__, (self, "${" + var + "}"), kw)
     self.var = SCons.Util.to_String(var)
     self.gen_kw = kw
Example #5
0
 def __init__(self, generator, kw):
     if __debug__:
         logInstanceCreation(self, "Action.CommandGeneratorAction")
     self.generator = generator
     self.gen_kw = kw
     self.varlist = kw.get("varlist", ())
     self.targets = kw.get("targets", "$TARGETS")
Example #6
0
    def __init__(self, execfunction, cmdstr=_null, *args, **kw):
        if __debug__: logInstanceCreation(self, 'Action.FunctionAction')

        if not cmdstr is _null:
            if callable(cmdstr):
                args = (cmdstr,)+args
            elif not (cmdstr is None or SCons.Util.is_String(cmdstr)):
                raise SCons.Errors.UserError(\
                    'Invalid function display variable type. ' \
                    'You must either pass a string or a callback which ' \
                    'accepts (target, source, env) as parameters.')

        self.execfunction = execfunction
        try:
            self.funccontents = _callable_contents(execfunction)
        except AttributeError:
            try:
                # See if execfunction will do the heavy lifting for us.
                self.gc = execfunction.get_contents
            except AttributeError:
                # This is weird, just do the best we can.
                self.funccontents = _object_contents(execfunction)

        apply(_ActionAction.__init__, (self,)+args, kw)
        self.varlist = kw.get('varlist', [])
        if SCons.Util.is_String(self.varlist):
            # prevent varlist="FOO" from being interpreted as ['F', 'O', 'O']
            self.varlist=[self.varlist]
        self.cmdstr = cmdstr
Example #7
0
 def __init__(self, action, env=None, overridelist=[], targets=[], sources=[]):
     if __debug__: logInstanceCreation(self)
     self.action = action
     self.env = env
     self.overridelist = overridelist
     self.targets = targets
     self.sources = sources[:]
Example #8
0
 def __init__(self, cmd, **kw):
     # Cmd list can actually be a list or a single item...basically
     # anything that we could pass in as the first arg to
     # Environment.subst_list().
     if __debug__: logInstanceCreation(self)
     apply(ActionBase.__init__, (self,), kw)
     self.cmd_list = cmd
Example #9
0
 def __init__(self, builder, env, overrides, targets, sources):
     if __debug__: logInstanceCreation(self)
     self.builder = builder
     self.env = env
     self.overrides = overrides
     self.targets = targets
     self.sources = sources[:]
Example #10
0
 def __init__(self, generator, kw):
     if SCons.Debug.track_instances:
         logInstanceCreation(self, 'Action.CommandGeneratorAction')
     self.generator = generator
     self.gen_kw = kw
     self.varlist = kw.get('varlist', ())
     self.targets = kw.get('targets', '$TARGETS')
 def __init__(self, var, kw):
     if SCons.Debug.track_instances:
         logInstanceCreation(self, "Action.LazyAction")
     # FUTURE CommandAction.__init__(self, '${'+var+'}', **kw)
     CommandAction.__init__(self, "${" + var + "}", **kw)
     self.var = SCons.Util.to_String(var)
     self.gen_kw = kw
Example #12
0
 def __init__(self, list):
     if __debug__: logInstanceCreation(self, 'Action.ListAction')
     def list_of_actions(x):
         if isinstance(x, ActionBase):
             return x
         return Action(x)
     self.list = map(list_of_actions, list)
Example #13
0
    def __init__(self, builder, cmdgen):
        if __debug__: logInstanceCreation(self)
        SCons.Util.Proxy.__init__(self, builder)

        # cmdgen should always be an instance of DictCmdGenerator.
        self.cmdgen = cmdgen
        self.builder = builder
Example #14
0
    def __init__(self, cmd, cmdstr=None, *args, **kw):
        # Cmd can actually be a list or a single item; if it's a
        # single item it should be the command string to execute; if a
        # list then it should be the words of the command string to
        # execute.  Only a single command should be executed by this
        # object; lists of commands should be handled by embedding
        # these objects in a ListAction object (which the Action()
        # factory above does).  cmd will be passed to
        # Environment.subst_list() for substituting environment
        # variables.
        if __debug__: logInstanceCreation(self, 'Action.CommandAction')

        if not cmdstr is None:
            if callable(cmdstr):
                args = (cmdstr,)+args
            elif not SCons.Util.is_String(cmdstr):
                raise SCons.Errors.UserError(\
                    'Invalid command display variable type. ' \
                    'You must either pass a string or a callback which ' \
                    'accepts (target, source, env) as parameters.')

        apply(_ActionAction.__init__, (self,)+args, kw)
        if SCons.Util.is_List(cmd):
            if filter(SCons.Util.is_List, cmd):
                raise TypeError, "CommandAction should be given only " \
                      "a single command"
        self.cmd_list = cmd
        self.cmdstr = cmdstr
Example #15
0
 def __init__(self, generator, kw):
     if __debug__:
         logInstanceCreation(self, 'Action.CommandGeneratorAction')
     self.generator = generator
     self.gen_kw = kw
     self.varlist = kw.get('varlist', ())
     self.targets = kw.get('targets', '$TARGETS')
Example #16
0
    def __init__(self,
                 action=None,
                 prefix='',
                 suffix='',
                 src_suffix='',
                 target_factory=SCons.Node.FS.default_fs.File,
                 source_factory=SCons.Node.FS.default_fs.File,
                 target_scanner=None,
                 source_scanner=None,
                 emitter=None,
                 multi=0,
                 env=None,
                 single_source=0,
                 name=None,
                 chdir=_null,
                 is_explicit=1,
                 **overrides):
        if __debug__: logInstanceCreation(self, 'BuilderBase')
        self.action = SCons.Action.Action(action)
        self.multi = multi
        if SCons.Util.is_Dict(prefix):
            prefix = CallableSelector(prefix)
        self.prefix = prefix
        if SCons.Util.is_Dict(suffix):
            suffix = CallableSelector(suffix)
        self.suffix = suffix
        self.env = env
        self.single_source = single_source
        if overrides.has_key('overrides'):
            SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning,
                "The \"overrides\" keyword to Builder() creation has been deprecated;\n" +\
                "\tspecify the items as keyword arguments to the Builder() call instead.")
            overrides.update(overrides['overrides'])
            del overrides['overrides']
        if overrides.has_key('scanner'):
            SCons.Warnings.warn(
                SCons.Warnings.DeprecatedWarning,
                "The \"scanner\" keyword to Builder() creation has been deprecated;\n"
                "\tuse: source_scanner or target_scanner as appropriate.")
            del overrides['scanner']
        self.overrides = overrides

        self.set_src_suffix(src_suffix)

        self.target_factory = target_factory
        self.source_factory = source_factory
        self.target_scanner = target_scanner
        self.source_scanner = source_scanner

        self.emitter = emitter

        # Optional Builder name should only be used for Builders
        # that don't get attached to construction environments.
        if name:
            self.name = name
        self.executor_kw = {}
        if not chdir is _null:
            self.executor_kw['chdir'] = chdir
        self.is_explicit = is_explicit
Example #17
0
 def __init__(self, builder, env, tlist):
     if __debug__: logInstanceCreation(self)
     SCons.Util.Proxy.__init__(self, builder)
     self.builder = builder
     self.scanner = builder.scanner
     self.env = env
     self.tlist = tlist
     self.multi = builder.multi
Example #18
0
    def __init__(self,  action = None,
                        prefix = '',
                        suffix = '',
                        src_suffix = '',
                        target_factory = None,
                        source_factory = None,
                        target_scanner = None,
                        source_scanner = None,
                        emitter = None,
                        multi = 0,
                        env = None,
                        single_source = 0,
                        name = None,
                        chdir = _null,
                        is_explicit = 1,
                        **overrides):
        if __debug__: logInstanceCreation(self, 'Builder.BuilderBase')
        self.action = action
        self.multi = multi
        if SCons.Util.is_Dict(prefix):
            prefix = CallableSelector(prefix)
        self.prefix = prefix
        if SCons.Util.is_Dict(suffix):
            suffix = CallableSelector(suffix)
        self.env = env
        self.single_source = single_source
        if overrides.has_key('overrides'):
            SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning,
                "The \"overrides\" keyword to Builder() creation has been deprecated;\n" +\
                "\tspecify the items as keyword arguments to the Builder() call instead.")
            overrides.update(overrides['overrides'])
            del overrides['overrides']
        if overrides.has_key('scanner'):
            SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning,
                                "The \"scanner\" keyword to Builder() creation has been deprecated;\n"
                                "\tuse: source_scanner or target_scanner as appropriate.")
            del overrides['scanner']
        self.overrides = overrides

        self.set_suffix(suffix)
        self.set_src_suffix(src_suffix)

        self.target_factory = target_factory
        self.source_factory = source_factory
        self.target_scanner = target_scanner
        self.source_scanner = source_scanner

        self.emitter = emitter

        # Optional Builder name should only be used for Builders
        # that don't get attached to construction environments.
        if name:
            self.name = name
        self.executor_kw = {}
        if not chdir is _null:
            self.executor_kw['chdir'] = chdir
        self.is_explicit = is_explicit
Example #19
0
    def __init__(self, list):
        if __debug__: logInstanceCreation(self, 'Action.ListAction')

        def list_of_actions(x):
            if isinstance(x, ActionBase):
                return x
            return Action(x)

        self.list = map(list_of_actions, list)
Example #20
0
 def __init__(self, builder, env, tlist):
     if __debug__: logInstanceCreation(self, 'Builder.ListBuilder')
     SCons.Util.Proxy.__init__(self, builder)
     self.builder = builder
     self.target_scanner = builder.target_scanner
     self.source_scanner = builder.source_scanner
     self.env = env
     self.tlist = tlist
     self.multi = builder.multi
     self.single_source = builder.single_source
Example #21
0
 def __init__(self, builder, env, tlist):
     if __debug__: logInstanceCreation(self, 'Builder.ListBuilder')
     SCons.Util.Proxy.__init__(self, builder)
     self.builder = builder
     self.target_scanner = builder.target_scanner
     self.source_scanner = builder.source_scanner
     self.env = env
     self.tlist = tlist
     self.multi = builder.multi
     self.single_source = builder.single_source
Example #22
0
 def __init__(self, list):
     if __debug__: logInstanceCreation(self, 'Action.ListAction')
     def list_of_actions(x):
         if isinstance(x, ActionBase):
             return x
         return Action(x)
     self.list = map(list_of_actions, list)
     # our children will have had any varlist
     # applied; we don't need to do it again
     self.varlist = ()
Example #23
0
 def __init__(self, actionlist):
     if SCons.Debug.track_instances: logInstanceCreation(self, 'Action.ListAction')
     def list_of_actions(x):
         if isinstance(x, ActionBase):
             return x
         return Action(x)
     self.list = list(map(list_of_actions, actionlist))
     # our children will have had any varlist
     # applied; we don't need to do it again
     self.varlist = ()
     self.targets = '$TARGETS'
Example #24
0
 def __init__(self, action, env=None, overridelist=[{}],
              targets=[], sources=[], builder_kw={}):
     if __debug__: logInstanceCreation(self, 'Executor.Executor')
     self.set_action_list(action)
     self.pre_actions = []
     self.post_actions = []
     self.env = env
     self.overridelist = overridelist
     self.targets = targets
     self.sources = sources[:]
     self.builder_kw = builder_kw
Example #25
0
 def __init__(self, actionlist):
     if __debug__: logInstanceCreation(self, 'Action.ListAction')
     def list_of_actions(x):
         if isinstance(x, ActionBase):
             return x
         return Action(x)
     self.list = list(map(list_of_actions, actionlist))
     # our children will have had any varlist
     # applied; we don't need to do it again
     self.varlist = ()
     self.targets = '$TARGETS'
Example #26
0
 def __init__(self,
              action,
              env=None,
              overridelist=[],
              targets=[],
              sources=[]):
     if __debug__: logInstanceCreation(self)
     self.action = action
     self.env = env
     self.overridelist = overridelist
     self.targets = targets
     self.sources = sources[:]
Example #27
0
 def __init__(self, action, env=None, overridelist=[{}],
              targets=[], sources=[], builder_kw={}):
     if SCons.Debug.track_instances: logInstanceCreation(self, 'Executor.Executor')
     self.set_action_list(action)
     self.pre_actions = []
     self.post_actions = []
     self.env = env
     self.overridelist = overridelist
     if targets or sources:
         self.batches = [Batch(targets[:], sources[:])]
     else:
         self.batches = []
     self.builder_kw = builder_kw
     self._memo = {}
Example #28
0
    def __init__(self):
        if SCons.Debug.track_instances: logInstanceCreation(self, 'Node.Node')
        # Note that we no longer explicitly initialize a self.builder
        # attribute to None here.  That's because the self.builder
        # attribute may be created on-the-fly later by a subclass (the
        # canonical example being a builder to fetch a file from a
        # source code system like CVS or Subversion).

        # Each list of children that we maintain is accompanied by a
        # dictionary used to look up quickly whether a node is already
        # present in the list.  Empirical tests showed that it was
        # fastest to maintain them as side-by-side Node attributes in
        # this way, instead of wrapping up each list+dictionary pair in
        # a class.  (Of course, we could always still do that in the
        # future if we had a good reason to...).
        self.sources = []  # source files used to build node
        self.sources_set = set()
        self._specific_sources = False
        self.depends = []  # explicit dependencies (from Depends)
        self.depends_set = set()
        self.ignore = []  # dependencies to ignore
        self.ignore_set = set()
        self.prerequisites = None
        self.implicit = None  # implicit (scanned) dependencies (None means not scanned yet)
        self.waiting_parents = set()
        self.waiting_s_e = set()
        self.ref_count = 0
        self.wkids = None  # Kids yet to walk, when it's an array

        self.env = None
        self.state = no_state
        self.precious = None
        self.pseudo = False
        self.noclean = 0
        self.nocache = 0
        self.cached = 0  # is this node pulled from cache?
        self.always_build = None
        self.includes = None
        self.attributes = self.Attrs(
        )  # Generic place to stick information about the Node.
        self.side_effect = 0  # true iff this node is a side effect
        self.side_effects = []  # the side effects of building this target
        self.linked = 0  # is this node linked to the variant directory?

        self.clear_memoized_values()

        # Let the interface in which the build engine is embedded
        # annotate this Node with its own info (like a description of
        # what line in what file created the node, for example).
        Annotate(self)
Example #29
0
 def __init__(self, action, env=None, overridelist=[{}],
              targets=[], sources=[], builder_kw={}):
     if __debug__: logInstanceCreation(self, 'Executor.Executor')
     self.set_action_list(action)
     self.pre_actions = []
     self.post_actions = []
     self.env = env
     self.overridelist = overridelist
     if targets or sources:
         self.batches = [Batch(targets[:], sources[:])]
     else:
         self.batches = []
     self.builder_kw = builder_kw
     self._memo = {}
Example #30
0
    def __init__(self):
        if SCons.Debug.track_instances:
            logInstanceCreation(self, "Node.Node")
        # Note that we no longer explicitly initialize a self.builder
        # attribute to None here.  That's because the self.builder
        # attribute may be created on-the-fly later by a subclass (the
        # canonical example being a builder to fetch a file from a
        # source code system like CVS or Subversion).

        # Each list of children that we maintain is accompanied by a
        # dictionary used to look up quickly whether a node is already
        # present in the list.  Empirical tests showed that it was
        # fastest to maintain them as side-by-side Node attributes in
        # this way, instead of wrapping up each list+dictionary pair in
        # a class.  (Of course, we could always still do that in the
        # future if we had a good reason to...).
        self.sources = []  # source files used to build node
        self.sources_set = set()
        self._specific_sources = False
        self.depends = []  # explicit dependencies (from Depends)
        self.depends_set = set()
        self.ignore = []  # dependencies to ignore
        self.ignore_set = set()
        self.prerequisites = None
        self.implicit = None  # implicit (scanned) dependencies (None means not scanned yet)
        self.waiting_parents = set()
        self.waiting_s_e = set()
        self.ref_count = 0
        self.wkids = None  # Kids yet to walk, when it's an array

        self.env = None
        self.state = no_state
        self.precious = None
        self.pseudo = False
        self.noclean = 0
        self.nocache = 0
        self.cached = 0  # is this node pulled from cache?
        self.always_build = None
        self.includes = None
        self.attributes = self.Attrs()  # Generic place to stick information about the Node.
        self.side_effect = 0  # true iff this node is a side effect
        self.side_effects = []  # the side effects of building this target
        self.linked = 0  # is this node linked to the variant directory?

        self.clear_memoized_values()

        # Let the interface in which the build engine is embedded
        # annotate this Node with its own info (like a description of
        # what line in what file created the node, for example).
        Annotate(self)
Example #31
0
    def __init__(self, execfunction, kw):
        if __debug__: logInstanceCreation(self, 'Action.FunctionAction')

        self.execfunction = execfunction
        try:
            self.funccontents = _callable_contents(execfunction)
        except AttributeError:
            try:
                # See if execfunction will do the heavy lifting for us.
                self.gc = execfunction.get_contents
            except AttributeError:
                # This is weird, just do the best we can.
                self.funccontents = _object_contents(execfunction)

        _ActionAction.__init__(self, **kw)
Example #32
0
    def __init__(self, execfunction, kw):
        if __debug__: logInstanceCreation(self, 'Action.FunctionAction')

        self.execfunction = execfunction
        try:
            self.funccontents = _callable_contents(execfunction)
        except AttributeError:
            try:
                # See if execfunction will do the heavy lifting for us.
                self.gc = execfunction.get_contents
            except AttributeError:
                # This is weird, just do the best we can.
                self.funccontents = _object_contents(execfunction)

        _ActionAction.__init__(self, **kw)
    def __init__(self,
                 platform=None,
                 tools=None,
                 toolpath=[],
                 options=None,
                 **kw):
        if __debug__: logInstanceCreation(self)
        self.fs = SCons.Node.FS.default_fs
        self.ans = SCons.Node.Alias.default_ans
        self.lookup_list = SCons.Node.arg2nodes_lookups
        self._dict = our_deepcopy(SCons.Defaults.ConstructionEnvironment)

        self._dict['__env__'] = self
        self._dict['BUILDERS'] = BuilderDict(self._dict['BUILDERS'], self)

        if platform is None:
            platform = self._dict.get('PLATFORM', None)
            if platform is None:
                platform = SCons.Platform.Platform()
        if SCons.Util.is_String(platform):
            platform = SCons.Platform.Platform(platform)
        self._dict['PLATFORM'] = str(platform)
        platform(self)

        # Apply the passed-in variables before calling the tools,
        # because they may use some of them:
        apply(self.Replace, (), kw)
        
        # Update the environment with the customizable options
        # before calling the tools, since they may use some of the options: 
        if options:
            options.Update(self)

        if tools is None:
            tools = self._dict.get('TOOLS', None)
            if tools is None:
                tools = ['default']
        apply_tools(self, tools, toolpath)

        # Reapply the passed in variables after calling the tools,
        # since they should overide anything set by the tools:
        apply(self.Replace, (), kw)

        # Update the environment with the customizable options
        # after calling the tools, since they should override anything
        # set by the tools:
        if options:
            options.Update(self)
Example #34
0
    def __init__(self,
                 platform=None,
                 tools=None,
                 toolpath=[],
                 options=None,
                 **kw):
        if __debug__: logInstanceCreation(self)
        self.fs = SCons.Node.FS.default_fs
        self.ans = SCons.Node.Alias.default_ans
        self.lookup_list = SCons.Node.arg2nodes_lookups
        self._dict = our_deepcopy(SCons.Defaults.ConstructionEnvironment)

        self._dict['__env__'] = self
        self._dict['BUILDERS'] = BuilderDict(self._dict['BUILDERS'], self)

        if platform is None:
            platform = self._dict.get('PLATFORM', None)
            if platform is None:
                platform = SCons.Platform.Platform()
        if SCons.Util.is_String(platform):
            platform = SCons.Platform.Platform(platform)
        self._dict['PLATFORM'] = str(platform)
        platform(self)

        # Apply the passed-in variables before calling the tools,
        # because they may use some of them:
        apply(self.Replace, (), kw)

        # Update the environment with the customizable options
        # before calling the tools, since they may use some of the options:
        if options:
            options.Update(self)

        if tools is None:
            tools = self._dict.get('TOOLS', None)
            if tools is None:
                tools = ['default']
        apply_tools(self, tools, toolpath)

        # Reapply the passed in variables after calling the tools,
        # since they should overide anything set by the tools:
        apply(self.Replace, (), kw)

        # Update the environment with the customizable options
        # after calling the tools, since they should override anything
        # set by the tools:
        if options:
            options.Update(self)
Example #35
0
    def __init__(self):
        if __debug__: logInstanceCreation(self, 'Node')
        # Note that we no longer explicitly initialize a self.builder
        # attribute to None here.  That's because the self.builder
        # attribute may be created on-the-fly later by a subclass (the
        # canonical example being a builder to fetch a file from a
        # source code system like CVS or Subversion).

        # Each list of children that we maintain is accompanied by a
        # dictionary used to look up quickly whether a node is already
        # present in the list.  Empirical tests showed that it was
        # fastest to maintain them as side-by-side Node attributes in
        # this way, instead of wrapping up each list+dictionary pair in
        # a class.  (Of course, we could always still do that in the
        # future if we had a good reason to...).
        self.sources = []  # source files used to build node
        self.sources_dict = {}
        self.depends = []  # explicit dependencies (from Depends)
        self.depends_dict = {}
        self.ignore = []  # dependencies to ignore
        self.ignore_dict = {}
        self.implicit = None  # implicit (scanned) dependencies (None means not scanned yet)
        self.waiting_parents = []
        self.wkids = None  # Kids yet to walk, when it's an array
        self.target_scanner = None  # explicit scanner from this node's Builder
        self.source_scanner = None
        self.backup_source_scanner = None

        self.env = None
        self.state = None
        self.precious = None
        self.always_build = None
        self.found_includes = {}
        self.includes = None
        self.overrides = {
        }  # construction variable overrides for building this node
        self.attributes = self.Attrs(
        )  # Generic place to stick information about the Node.
        self.side_effect = 0  # true iff this node is a side effect
        self.side_effects = []  # the side effects of building this target
        self.pre_actions = []
        self.post_actions = []
        self.linked = 0  # is this node linked to the build directory?

        # Let the interface in which the build engine is embedded
        # annotate this Node with its own info (like a description of
        # what line in what file created the node, for example).
        Annotate(self)
Example #36
0
    def __init__(self, execfunction, cmdstr=_null, *args, **kw):
        if __debug__: logInstanceCreation(self, 'Action.FunctionAction')

        if not cmdstr is _null:
            if callable(cmdstr):
                args = (cmdstr, ) + args
            elif not (cmdstr is None or SCons.Util.is_String(cmdstr)):
                raise SCons.Errors.UserError(\
                    'Invalid function display variable type. ' \
                    'You must either pass a string or a callback which ' \
                    'accepts (target, source, env) as parameters.')

        self.execfunction = execfunction
        apply(_ActionAction.__init__, (self, ) + args, kw)
        self.varlist = kw.get('varlist', [])
        self.cmdstr = cmdstr
Example #37
0
    def __init__(self, execfunction, cmdstr=_null, *args, **kw):
        if __debug__: logInstanceCreation(self, 'Action.FunctionAction')

        if not cmdstr is _null:
            if callable(cmdstr):
                args = (cmdstr,)+args
            elif not (cmdstr is None or SCons.Util.is_String(cmdstr)):
                raise SCons.Errors.UserError(\
                    'Invalid function display variable type. ' \
                    'You must either pass a string or a callback which ' \
                    'accepts (target, source, env) as parameters.')

        self.execfunction = execfunction
        apply(_ActionAction.__init__, (self,)+args, kw)
        self.varlist = kw.get('varlist', [])
        self.cmdstr = cmdstr
Example #38
0
 def __init__(self,
              action,
              env=None,
              overridelist=[{}],
              targets=[],
              sources=[],
              builder_kw={}):
     if __debug__: logInstanceCreation(self)
     if not action:
         raise SCons.Errors.UserError, "Executor must have an action."
     self.action = action
     self.env = env
     self.overridelist = overridelist
     self.targets = targets
     self.sources = sources[:]
     self.builder_kw = builder_kw
Example #39
0
    def __init__(self):
        if __debug__: logInstanceCreation(self, 'Node')
        # Note that we no longer explicitly initialize a self.builder
        # attribute to None here.  That's because the self.builder
        # attribute may be created on-the-fly later by a subclass (the
        # canonical example being a builder to fetch a file from a
        # source code system like CVS or Subversion).

        # Each list of children that we maintain is accompanied by a
        # dictionary used to look up quickly whether a node is already
        # present in the list.  Empirical tests showed that it was
        # fastest to maintain them as side-by-side Node attributes in
        # this way, instead of wrapping up each list+dictionary pair in
        # a class.  (Of course, we could always still do that in the
        # future if we had a good reason to...).
        self.sources = []       # source files used to build node
        self.sources_dict = {}
        self.depends = []       # explicit dependencies (from Depends)
        self.depends_dict = {}
        self.ignore = []        # dependencies to ignore
        self.ignore_dict = {}
        self.implicit = None    # implicit (scanned) dependencies (None means not scanned yet)
        self.waiting_parents = []
        self.wkids = None       # Kids yet to walk, when it's an array
        self.target_scanner = None      # explicit scanner from this node's Builder
        self.source_scanner = None
        self.backup_source_scanner = None

        self.env = None
        self.state = None
        self.precious = None
        self.always_build = None
        self.found_includes = {}
        self.includes = None
        self.overrides = {}     # construction variable overrides for building this node
        self.attributes = self.Attrs() # Generic place to stick information about the Node.
        self.side_effect = 0 # true iff this node is a side effect
        self.side_effects = [] # the side effects of building this target
        self.pre_actions = []
        self.post_actions = []
        self.linked = 0 # is this node linked to the build directory? 

        # Let the interface in which the build engine is embedded
        # annotate this Node with its own info (like a description of
        # what line in what file created the node, for example).
        Annotate(self)
Example #40
0
    def __init__(self, cmd, **kw):
        # Cmd can actually be a list or a single item; if it's a
        # single item it should be the command string to execute; if a
        # list then it should be the words of the command string to
        # execute.  Only a single command should be executed by this
        # object; lists of commands should be handled by embedding
        # these objects in a ListAction object (which the Action()
        # factory above does).  cmd will be passed to
        # Environment.subst_list() for substituting environment
        # variables.
        if SCons.Debug.track_instances: logInstanceCreation(self, 'Action.CommandAction')

        _ActionAction.__init__(self, **kw)
        if is_List(cmd):
            if list(filter(is_List, cmd)):
                raise TypeError("CommandAction should be given only " \
                      "a single command")
        self.cmd_list = cmd
Example #41
0
 def __init__(self, cmd, cmdstr=None, *args, **kw):
     # Cmd can actually be a list or a single item; if it's a
     # single item it should be the command string to execute; if a
     # list then it should be the words of the command string to
     # execute.  Only a single command should be executed by this
     # object; lists of commands should be handled by embedding
     # these objects in a ListAction object (which the Action()
     # factory above does).  cmd will be passed to
     # Environment.subst_list() for substituting environment
     # variables.
     if __debug__: logInstanceCreation(self)
     apply(_ActionAction.__init__, (self,)+args, kw)
     if SCons.Util.is_List(cmd):
         if filter(SCons.Util.is_List, cmd):
             raise TypeError, "CommandAction should be given only " \
                   "a single command"
     self.cmd_list = cmd
     self.cmdstr = cmdstr
Example #42
0
    def __init__(self, cmd, **kw):
        # Cmd can actually be a list or a single item; if it's a
        # single item it should be the command string to execute; if a
        # list then it should be the words of the command string to
        # execute.  Only a single command should be executed by this
        # object; lists of commands should be handled by embedding
        # these objects in a ListAction object (which the Action()
        # factory above does).  cmd will be passed to
        # Environment.subst_list() for substituting environment
        # variables.
        if __debug__: logInstanceCreation(self, 'Action.CommandAction')

        _ActionAction.__init__(self, **kw)
        if is_List(cmd):
            if list(filter(is_List, cmd)):
                raise TypeError("CommandAction should be given only " \
                      "a single command")
        self.cmd_list = cmd
Example #43
0
 def __init__(self,  src_builder,
                     action = None,
                     prefix = '',
                     suffix = '',
                     src_suffix = '',
                     target_factory = None,
                     source_factory = None,
                     target_scanner = None,
                     source_scanner = None,
                     emitter=None,
                     single_source=0):
     if __debug__: logInstanceCreation(self, 'Builder.MultiStepBuilder')
     BuilderBase.__init__(self, action, prefix, suffix, src_suffix,
                          target_factory, source_factory,
                          target_scanner, source_scanner, emitter,
                          single_source = single_source)
     if not SCons.Util.is_List(src_builder):
         src_builder = [ src_builder ]
     self.src_builder = src_builder
Example #44
0
 def __init__(self,  src_builder,
                     action = None,
                     prefix = '',
                     suffix = '',
                     src_suffix = '',
                     target_factory = None,
                     source_factory = None,
                     target_scanner = None,
                     source_scanner = None,
                     emitter=None,
                     single_source=0):
     if __debug__: logInstanceCreation(self, 'Builder.MultiStepBuilder')
     BuilderBase.__init__(self, action, prefix, suffix, src_suffix,
                          target_factory, source_factory,
                          target_scanner, source_scanner, emitter,
                          single_source = single_source)
     if not SCons.Util.is_List(src_builder):
         src_builder = [ src_builder ]
     self.src_builder = src_builder
Example #45
0
 def __init__(self,  src_builder,
                     action = None,
                     prefix = '',
                     suffix = '',
                     src_suffix = '',
                     node_factory = SCons.Node.FS.default_fs.File,
                     target_factory = None,
                     source_factory = None,
                     scanner=None,
                     emitter=None):
     if __debug__: logInstanceCreation(self)
     BuilderBase.__init__(self, action, prefix, suffix, src_suffix,
                          node_factory, target_factory, source_factory,
                          scanner, emitter)
     if not SCons.Util.is_List(src_builder):
         src_builder = [ src_builder ]
     self.src_builder = src_builder
     self.sdict = {}
     self.cached_src_suffixes = {} # source suffixes keyed on id(env)
Example #46
0
    def __init__(self,
                 action=None,
                 prefix='',
                 suffix='',
                 src_suffix='',
                 target_factory=SCons.Node.FS.default_fs.File,
                 source_factory=SCons.Node.FS.default_fs.File,
                 target_scanner=None,
                 source_scanner=None,
                 emitter=None,
                 multi=0,
                 env=None,
                 single_source=0,
                 **overrides):
        if __debug__: logInstanceCreation(self, 'BuilderBase')
        self.action = SCons.Action.Action(action)
        self.multi = multi
        if SCons.Util.is_Dict(prefix):
            prefix = CallableSelector(prefix)
        self.prefix = prefix
        if SCons.Util.is_Dict(suffix):
            suffix = CallableSelector(suffix)
        self.suffix = suffix
        self.env = env
        self.single_source = single_source
        if overrides.has_key('overrides'):
            SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning,
                "The \"overrides\" keyword to Builder() creation has been deprecated;\n" +\
                "\tspecify the items as keyword arguments to the Builder() call instead.")
            overrides.update(overrides['overrides'])
            del overrides['overrides']
        self.overrides = overrides

        self.set_src_suffix(src_suffix)

        self.target_factory = target_factory
        self.source_factory = source_factory
        self.target_scanner = target_scanner
        self.source_scanner = source_scanner

        self.emitter = emitter
Example #47
0
 def __init__(self, execfunction, strfunction=_null, varlist=[]):
     if __debug__: logInstanceCreation(self)
     self.execfunction = execfunction
     if strfunction is _null:
         def strfunction(target, source, env, execfunction=execfunction):
             def quote(s):
                 return '"' + str(s) + '"'
             def array(a, q=quote):
                 return '[' + string.join(map(lambda x, q=q: q(x), a), ", ") + ']'
             try:
                 name = execfunction.__name__
             except AttributeError:
                 try:
                     name = execfunction.__class__.__name__
                 except AttributeError:
                     name = "unknown_python_function"
             tstr = len(target) == 1 and quote(target[0]) or array(target)
             sstr = len(source) == 1 and quote(source[0]) or array(source)
             return "%s(%s, %s)" % (name, tstr, sstr)
     self.strfunction = strfunction
     self.varlist = varlist
Example #48
0
    def __init__(self,  action = None,
                        prefix = '',
                        suffix = '',
                        src_suffix = '',
                        target_factory = SCons.Node.FS.default_fs.File,
                        source_factory = SCons.Node.FS.default_fs.File,
                        target_scanner = None,
                        source_scanner = None,
                        emitter = None,
                        multi = 0,
                        env = None,
                        single_source = 0,
                        **overrides):
        if __debug__: logInstanceCreation(self, 'BuilderBase')
        self.action = SCons.Action.Action(action)
        self.multi = multi
        if SCons.Util.is_Dict(prefix):
            prefix = CallableSelector(prefix)
        self.prefix = prefix
        if SCons.Util.is_Dict(suffix):
            suffix = CallableSelector(suffix)
        self.suffix = suffix
        self.env = env
        self.single_source = single_source
        if overrides.has_key('overrides'):
            SCons.Warnings.warn(SCons.Warnings.DeprecatedWarning,
                "The \"overrides\" keyword to Builder() creation has been deprecated;\n" +\
                "\tspecify the items as keyword arguments to the Builder() call instead.")
            overrides.update(overrides['overrides'])
            del overrides['overrides']
        self.overrides = overrides

        self.set_src_suffix(src_suffix)

        self.target_factory = target_factory
        self.source_factory = source_factory
        self.target_scanner = target_scanner
        self.source_scanner = source_scanner

        self.emitter = emitter
Example #49
0
 def __init__(self, var, *args, **kw):
     if __debug__: logInstanceCreation(self, 'Action.LazyAction')
     apply(CommandAction.__init__, (self, '$' + var) + args, kw)
     self.var = SCons.Util.to_String(var)
     self.gen_args = args
     self.gen_kw = kw
Example #50
0
 def __init__(self, generator, *args, **kw):
     if __debug__:
         logInstanceCreation(self, 'Action.CommandGeneratorAction')
     self.generator = generator
     self.gen_args = args
     self.gen_kw = kw
Example #51
0
 def __init__(self, var, kw):
     if __debug__: logInstanceCreation(self, 'Action.LazyAction')
     #FUTURE CommandAction.__init__(self, '${'+var+'}', **kw)
     apply(CommandAction.__init__, (self, '${' + var + '}'), kw)
     self.var = SCons.Util.to_String(var)
     self.gen_kw = kw
Example #52
0
 def __init__(self, generator, kw):
     if __debug__:
         logInstanceCreation(self, 'Action.CommandGeneratorAction')
     self.generator = generator
     self.gen_kw = kw
     self.varlist = kw.get('varlist', ())
Example #53
0
 def __init__(self, dict):
     UserDict.__init__(self, dict)
     if SCons.Debug.track_instances:
         logInstanceCreation(self, 'Builder.OverrideWarner')
     self.already_warned = None
Example #54
0
 def __init__(self, *args, **kw):
     if __debug__: logInstanceCreation(self, 'Executor.Null')
     kw['action'] = []
     apply(_Executor.__init__, (self,), kw)
Example #55
0
 def __init__(self, dict):
     collections.UserDict.__init__(self, dict)
     if __debug__: logInstanceCreation(self, 'Builder.OverrideWarner')
     self.already_warned = None
Example #56
0
 def __init__(self, *args, **kw):
     if __debug__:
         logInstanceCreation(self, 'Executor.Null')
     self.batches = [Batch(kw['targets'][:], [])]
Example #57
0
    def __init__(self,
                 action=None,
                 prefix='',
                 suffix='',
                 src_suffix='',
                 target_factory=None,
                 source_factory=None,
                 target_scanner=None,
                 source_scanner=None,
                 emitter=None,
                 multi=0,
                 env=None,
                 single_source=0,
                 name=None,
                 chdir=_null,
                 is_explicit=1,
                 src_builder=None,
                 ensure_suffix=False,
                 **overrides):
        if SCons.Debug.track_instances:
            logInstanceCreation(self, 'Builder.BuilderBase')
        self._memo = {}
        self.action = action
        self.multi = multi
        if SCons.Util.is_Dict(prefix):
            prefix = CallableSelector(prefix)
        self.prefix = prefix
        if SCons.Util.is_Dict(suffix):
            suffix = CallableSelector(suffix)
        self.env = env
        self.single_source = single_source
        if 'overrides' in overrides:
            SCons.Warnings.warn(SCons.Warnings.DeprecatedBuilderKeywordsWarning,
                "The \"overrides\" keyword to Builder() creation has been deprecated;\n" +\
                "\tspecify the items as keyword arguments to the Builder() call instead.")
            overrides.update(overrides['overrides'])
            del overrides['overrides']
        if 'scanner' in overrides:
            SCons.Warnings.warn(
                SCons.Warnings.DeprecatedBuilderKeywordsWarning,
                "The \"scanner\" keyword to Builder() creation has been deprecated;\n"
                "\tuse: source_scanner or target_scanner as appropriate.")
            del overrides['scanner']
        self.overrides = overrides

        self.set_suffix(suffix)
        self.set_src_suffix(src_suffix)
        self.ensure_suffix = ensure_suffix

        self.target_factory = target_factory
        self.source_factory = source_factory
        self.target_scanner = target_scanner
        self.source_scanner = source_scanner

        self.emitter = emitter

        # Optional Builder name should only be used for Builders
        # that don't get attached to construction environments.
        if name:
            self.name = name
        self.executor_kw = {}
        if not chdir is _null:
            self.executor_kw['chdir'] = chdir
        self.is_explicit = is_explicit

        if src_builder is None:
            src_builder = []
        elif not SCons.Util.is_List(src_builder):
            src_builder = [src_builder]
        self.src_builder = src_builder