예제 #1
0
파일: Builder.py 프로젝트: mhoye/Bespoke_IO
    def __init__(self, builder, cmdgen):
        if __debug__: logInstanceCreation(self, 'Builder.CompositeBuilder')
        repackMsi.Util.Proxy.__init__(self, builder)

        # cmdgen should always be an instance of DictCmdGenerator.
        self.cmdgen = cmdgen
        self.builder = builder
예제 #2
0
파일: Action.py 프로젝트: mhoye/Bespoke_IO
 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'
예제 #3
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 = {}
예제 #4
0
파일: Action.py 프로젝트: mhoye/Bespoke_IO
    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)
예제 #5
0
파일: Action.py 프로젝트: mhoye/Bespoke_IO
    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
예제 #6
0
파일: Action.py 프로젝트: mhoye/Bespoke_IO
 def __init__(self, var, kw):
     if __debug__: logInstanceCreation(self, 'Action.LazyAction')
     #FUTURE CommandAction.__init__(self, '${'+var+'}', **kw)
     CommandAction.__init__(self, '${'+var+'}', **kw)
     self.var = repackMsi.Util.to_String(var)
     self.gen_kw = kw
예제 #7
0
파일: Action.py 프로젝트: mhoye/Bespoke_IO
 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')
예제 #8
0
 def __init__(self, *args, **kw):
     if __debug__: logInstanceCreation(self, 'Executor.Null')
     self.batches = [Batch(kw['targets'][:], [])]
예제 #9
0
파일: Builder.py 프로젝트: mhoye/Bespoke_IO
    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 __debug__: logInstanceCreation(self, 'Builder.BuilderBase')
        self._memo = {}
        self.action = action
        self.multi = multi
        if repackMsi.Util.is_Dict(prefix):
            prefix = CallableSelector(prefix)
        self.prefix = prefix
        if repackMsi.Util.is_Dict(suffix):
            suffix = CallableSelector(suffix)
        self.env = env
        self.single_source = single_source
        if 'overrides' in overrides:
            repackMsi.Warnings.warn(repackMsi.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:
            repackMsi.Warnings.warn(repackMsi.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 repackMsi.Util.is_List(src_builder):
            src_builder = [ src_builder ]
        self.src_builder = src_builder
예제 #10
0
파일: Builder.py 프로젝트: mhoye/Bespoke_IO
 def __init__(self, dict):
     collections.UserDict.__init__(self, dict)
     if __debug__: logInstanceCreation(self, 'Builder.OverrideWarner')
     self.already_warned = None