コード例 #1
0
ファイル: __init__.py プロジェクト: teknoraver/snapcraft
def _make_options(part_schema, properties, plugin_schema):
    # Make copies as these dictionaries are tampered with
    part_schema = part_schema.copy()
    properties = properties.copy()

    plugin_schema = _merged_part_and_plugin_schemas(part_schema, plugin_schema)

    # This is for backwards compatibility for when most of the
    # schema was overridable by the plugins.
    if 'required' in plugin_schema and not plugin_schema['required']:
        del plugin_schema['required']
    # With the same backwards compatibility in mind we need to remove
    # the source entry before validation. To those concerned, it has
    # already been validated.
    validated_properties = properties.copy()
    remove_set = [
        k for k in sources.get_source_defaults().keys()
        if k in validated_properties
    ]
    for key in remove_set:
        del validated_properties[key]

    jsonschema.validate(validated_properties, plugin_schema)

    options = _populate_options(properties, plugin_schema)

    return options
コード例 #2
0
ファイル: pluginhandler.py プロジェクト: seawaywen/snapcraft
    def mark_pull_done(self):
        pull_properties = self.code.get_pull_properties()
        pull_properties.extend(sources.get_source_defaults().keys())

        self.mark_done('pull', states.PullState(
            pull_properties, self._part_properties,
            self._project_options))
コード例 #3
0
ファイル: __init__.py プロジェクト: squidsoup/snapcraft
def _make_options(part_schema, properties, plugin_schema):
    # Make copies as these dictionaries are tampered with
    part_schema = part_schema.copy()
    properties = properties.copy()

    plugin_schema = _merged_part_and_plugin_schemas(part_schema, plugin_schema)

    # This is for backwards compatibility for when most of the
    # schema was overridable by the plugins.
    if 'required' in plugin_schema and not plugin_schema['required']:
            del plugin_schema['required']
    # With the same backwards compatibility in mind we need to remove
    # the source entry before validation. To those concerned, it has
    # already been validated.
    validated_properties = properties.copy()
    remove_set = [k for k in sources.get_source_defaults().keys()
                  if k in validated_properties]
    for key in remove_set:
        del validated_properties[key]

    jsonschema.validate(validated_properties, plugin_schema)

    options = _populate_options(properties, plugin_schema)

    return options
コード例 #4
0
ファイル: pluginhandler.py プロジェクト: seawaywen/snapcraft
    def _setup_source(self, original_properties):
        """Returns properties with sources included."""
        properties = sources.get_source_defaults()
        # Update with full length of properties
        properties.update(original_properties)

        return properties