How to use the snapcraft.formatting_utils.humanize_list function in snapcraft

To help you get started, we’ve selected a few snapcraft examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github snapcore / snapcraft / snapcraft / cli / store.py View on Github external
If --release is used, the channel map will be displayed after the
    operation takes place.

    \b
    Examples:
        snapcraft push my-snap_0.1_amd64.snap
        snapcraft push my-snap_0.2_amd64.snap --release edge
        snapcraft push my-snap_0.3_amd64.snap --release candidate,beta
    """
    click.echo("Preparing to push {!r}.".format(os.path.basename(snap_file)))
    if release:
        channel_list = release.split(",")
        click.echo(
            "After pushing, the resulting snap revision will be released to "
            "{} when it passes the Snap Store review."
            "".format(formatting_utils.humanize_list(channel_list, "and"))
        )
    else:
        channel_list = None

    review_snap(snap_file=snap_file)
    snapcraft.push(snap_file, channel_list)
github snapcore / snapcraft / snapcraft / internal / meta / errors.py View on Github external
def __init__(self, keys: List[str]) -> None:
        super().__init__(keys=formatting_utils.humanize_list(keys, "and"))
github snapcore / snapcraft / snapcraft / plugins / dotnet.py View on Github external
def __init__(self, *, architecture: str, supported: List[str]) -> None:
        super().__init__(
            architecture=architecture,
            supported=formatting_utils.humanize_list(supported, "and"),
        )
github snapcore / snapcraft / snapcraft / internal / lifecycle.py View on Github external
def _verify_dependents_will_be_cleaned(part_name, clean_part_names, step,
                                       config):
    # Get the name of the parts that depend upon this one
    dependents = config.parts.get_dependents(part_name)
    additional_dependents = []

    # Verify that they're either already clean, or that they will be cleaned.
    if not dependents.issubset(clean_part_names):
        for part in config.all_parts:
            if part.name in dependents and not part.is_clean(step):
                humanized_parts = formatting_utils.humanize_list(
                    dependents, 'and')
                additional_dependents.append(part_name)

                logger.warning(
                    'Requested clean of {!r} which requires also cleaning '
                    'the part{} {}'.format(part_name,
                                           '' if len(dependents) == 1 else 's',
                                           humanized_parts))
github snapcore / snapcraft / snapcraft / cli / remote.py View on Github external
def _monitor_build(lp: LaunchpadClient) -> None:
    target_list = humanize_list(lp.architectures, "and", "{}")
    echo.info(
        f"Building snap package for {target_list}. This may take some time to finish."
    )

    lp.monitor_build()

    echo.info("Build complete.")
    lp.cleanup()
github snapcore / snapcraft / snapcraft / plugins / gradle.py View on Github external
def __init__(
        self, *, base: str, version: str, valid_versions: Sequence[str]
    ) -> None:
        super().__init__(
            base=base,
            version=version,
            valid_versions=formatting_utils.humanize_list(
                valid_versions, conjunction="or"
            ),
github snapcore / snapcraft / snapcraft / plugins / maven.py View on Github external
def __init__(
        self, *, base: str, version: str, valid_versions: Sequence[str]
    ) -> None:
        super().__init__(
            base=base,
            version=version,
            valid_versions=formatting_utils.humanize_list(
                valid_versions, conjunction="or"
            ),
github snapcore / snapcraft / snapcraft / plugins / ant.py View on Github external
def __init__(
        self, *, base: str, version: str, valid_versions: Sequence[str]
    ) -> None:
        super().__init__(
            base=base,
            version=version,
            valid_versions=formatting_utils.humanize_list(
                valid_versions, conjunction="or"
            ),
github snapcore / snapcraft / snapcraft / internal / pluginhandler / _outdated_report.py View on Github external
def get_summary(self) -> str:
        """Get summarized report.

        :return: Short summary of why the step is dirty.
        :rtype: str
        """
        reasons = []

        if self.previous_step_modified:
            reasons.append("{!r} step".format(self.previous_step_modified.name))

        if self.source_updated:
            reasons.append("source")

        return "{} changed".format(formatting_utils.humanize_list(reasons, "and", "{}"))
github snapcore / snapcraft / snapcraft / internal / project_loader / _templates / _utils.py View on Github external
applied_template_names.update(template_names)

        # Now that templates have been applied, remove the specification from
        # this app
        with contextlib.suppress(KeyError):
            del yaml_data["apps"][app_name]["templates"]

    # Now that templates have been applied, remove the global specification
    with contextlib.suppress(KeyError):
        del yaml_data["templates"]

    unused_templates = set(global_template_names) - applied_template_names
    if unused_templates:
        logger.warning(
            "The following templates are declared, but not used: {}".format(
                formatting_utils.humanize_list(unused_templates, "and")
            )
        )

    return yaml_data