Example #1
0
    def apply(self):
        """
        Actually apply the config changes to the running buildout.
        """
        self.before_apply = _unannotate(copy.deepcopy(self.data))

        # Reinject the original buildout so it can overlay and extend the one from the stack
        # We don't reapply default values as the stack might want to override defaults.
        def filter_annotations(annotated):
            out = {}
            for section, values in annotated.items():
                out[section] = {}
                for k, v in values.items():
                    if v[1] == 'DEFAULT_VALUE':
                        continue
                    out[section][k] = v
            return out
        _update(self.data, filter_annotations(self.buildout._annotated))

        # Actually update the buildout
        self.buildout._annotated = copy.deepcopy(self.data)
        self.buildout._raw = _unannotate(self.data)

        self.determine_cwd()
        self.update_buildout_options()
        self.update_versions()
        self.load_extensions()

        self.run_commands()
Example #2
0
    def load(self, path, optional=False):
        config_file = path
        if not path.startswith("/"):
            config_file = sibpath(self.name, path)
        if not os.path.exists(config_file):
            if not optional:
                raise UserError("Could not load '%s'" % path)
            return

        self.log.debug("Loading '%s' from stack" % config_file)
        override = {}
        _update(self.data, _open(os.path.dirname(config_file), config_file, [],
                               self.data['buildout'].copy(), override, set()))