コード例 #1
0
    def to_exclude(self, *names, **kwargs):
        """Compute a set of stages to exclude. This will load all stages in the
        exclude property to do so. If one entry there is a StageContainer then
        all stages in it will be excluded.
        """

        skip_dependencies = kwargs.get('skip_dependencies', False)
        if skip_dependencies:
            return True

        exclude = set()
        for name in names:
            klass = intro.get_loader(name)
            stage = klass(*self._args)
            exclude.add(name)
            if isinstance(stage, core.StageContainer):
                exclude.update(s.name for s in stage.expand())
        return exclude
コード例 #2
0
    def to_exclude(self, *names, **kwargs):
        """Compute a set of stages to exclude. This will load all stages in the
        exclude property to do so. If one entry there is a StageContainer then
        all stages in it will be excluded.
        """

        skip_dependencies = kwargs.get('skip_dependencies', False)
        if skip_dependencies:
            return True

        exclude = set()
        for name in names:
            klass = intro.get_loader(name)
            stage = klass(*self._args)
            exclude.add(name)
            if isinstance(stage, core.StageContainer):
                exclude.update(s.name for s in stage.expand())
        return exclude
コード例 #3
0
    def stages(self, name):
        """Determine all stages to run and in what order for the given stage
        name. If dependencies is set to True then this will go through all
        dependecies of the given stage and place them in a tree, as well as all
        of their dependecies and so forth. The stages will be sorted
        topologically and then returned in that order.

        If dependecies is False, then a list of one element, the specified
        stage will be returned.

        :param str name: The name of the stage to run.
        :returns: A list of the stages to run.
        """

        allowed = set()
        exclude = self.to_exclude(*self.exclude)
        klass = intro.get_loader(name)
        stage = klass(*self._args)

        if self.skip_dependencies:
            allowed.add(stage.name)
            exclude = True

        deps = None
        if isinstance(stage, core.StageContainer):
            allowed.update(s.name for s in stage.expand())
            allowed.discard(stage.name)
            if exclude is not True:
                allowed.difference_update(exclude)
            if not self.skip_dependencies:
                exclude.add(stage.name)
            deps = self.dependencies(stage.stages)
        else:
            deps = self.dependencies([klass])

        return self.flatten(deps, exclude, allowed)
コード例 #4
0
    def stages(self, name):
        """Determine all stages to run and in what order for the given stage
        name. If dependencies is set to True then this will go through all
        dependecies of the given stage and place them in a tree, as well as all
        of their dependecies and so forth. The stages will be sorted
        topologically and then returned in that order.

        If dependecies is False, then a list of one element, the specified
        stage will be returned.

        :param str name: The name of the stage to run.
        :returns: A list of the stages to run.
        """

        allowed = set()
        exclude = self.to_exclude(*self.exclude)
        klass = intro.get_loader(name)
        stage = klass(*self._args)

        if self.skip_dependencies:
            allowed.add(stage.name)
            exclude = True

        deps = None
        if isinstance(stage, core.StageContainer):
            allowed.update(s.name for s in stage.expand())
            allowed.discard(stage.name)
            if exclude is not True:
                allowed.difference_update(exclude)
            if not self.skip_dependencies:
                exclude.add(stage.name)
            deps = self.dependencies(stage.stages)
        else:
            deps = self.dependencies([klass])

        return self.flatten(deps, exclude, allowed)
コード例 #5
0
 def test_can_get_a_mass_loader(self):
     self.assertEquals(update.Loader, intro.get_loader('update'))
コード例 #6
0
 def test_can_get_a_loader_by_stage_name(self):
     self.assertEquals(info.Loader, intro.get_loader('ife.info'))