Example #1
0
 def get_commands(self, session):
     """Pick a command and run it.
     """
     commands = working_set.list_entry_points("setup_commands")
     if len(session.args):
         name = session.args[0]
         command = commands.get(name, None)
         if command is None:
             raise InstallationError(u"Unknow command %s" % name)
     else:
         command = commands.get("default", None)
         if command is None:
             raise InstallationError(u"No command available")
     return [working_set.get_entry_point("setup_commands", command["name"])]
Example #2
0
    def __init__(self, configuration):
        from monteur.distribution.workingset import working_set

        self.loaders = []
        names = configuration['setup'].get(
            self.CONFIG_KEY, 'egg,monteur').as_list()
        defined_loaders = working_set.list_entry_points('setup_loaders')
        for name in names:
            if name not in defined_loaders:
                raise ConfigurationError(u'Undefined setup loader', name)
            factory = working_set.get_entry_point(
                'setup_loaders', defined_loaders[name]['name'])
            if factory is not None:
                self.loaders.append(factory(configuration.get(
                            ':'.join((self.CONFIG_KEY, name)), None)))
Example #3
0
    def __init__(self, configuration, section_name='setup'):
        __status__ = u"Initializing software sources."
        self.sources = []
        self.configuration = configuration
        self.installed = configuration.utilities.installed

        defined_sources = working_set.list_entry_points('setup_sources')
        for name in configuration[section_name]['sources'].as_list():
            options = configuration['source:' + name]
            source_type = options['type'].as_text()
            if source_type not in defined_sources:
                raise ConfigurationError(
                    u'Unknow source type %s for %s' % (
                        source_type, name))
            factory = working_set.get_entry_point(
                'setup_sources',
                defined_sources[source_type]['name'])
            self.sources.append(
                factory(
                    options,
                    self.installed.get('source:' + name, None)))
        self._uptodate = None