Exemplo n.º 1
0
def add_platforms(project, environment, platforms):
    """Add platforms to the project."""
    project = load_project(project)
    status = project_ops.add_platforms(project, env_spec_name=environment, platforms=platforms)
    package_list = ", ".join(platforms)
    if environment is None:
        success_message = "Added platforms to project file: %s." % (package_list)
    else:
        success_message = "Added platforms to environment %s in project file: %s." % (environment, package_list)
    return _handle_status(status, success_message)
Exemplo n.º 2
0
    def add_platforms(self, project, env_spec_name, platforms):
        """Attempt to add platforms the project supports.

        If the env_spec_name is None rather than an env name,
        packages are added in the global platforms section (to
        all environment specs).

        The returned ``Status`` should be a ``RequirementStatus`` for
        the environment requirement if it evaluates to True (on success),
        but may be another subtype of ``Status`` on failure. A False
        status will have an ``errors`` property with a list of error
        strings.

        Args:
            project (Project): the project
            env_spec_name (str): environment spec name or None for all environment specs
            platforms (list of str): platforms to add

        Returns:
            ``Status`` instance
        """
        return project_ops.add_platforms(project=project, env_spec_name=env_spec_name, platforms=platforms)