Example #1
0
def _install_cli(pkg):
    """Install subcommand cli

    :param pkg: the package to install
    :type pkg: PackageVersion
    :rtype: None
    """

    with util.remove_path_on_error(_package_dir(pkg.name())) as pkg_dir:
        env_dir = os.path.join(pkg_dir, constants.DCOS_SUBCOMMAND_ENV_SUBDIR)

        resources = pkg.resource_json()

        if resources and resources.get("cli") is not None:
            binary = resources["cli"]
            binary_cli = _get_cli_binary_info(binary)
            _install_with_binary(pkg.name(), env_dir, binary_cli)
        elif pkg.command_json() is not None:
            install_operation = pkg.command_json()
            if 'pip' in install_operation:
                _install_with_pip(pkg.name(), env_dir,
                                  install_operation['pip'])
            else:
                raise DCOSException(
                    "Installation methods '{}' not supported".format(
                        install_operation.keys()))
        else:
            raise DCOSException(
                "Could not find a CLI subcommand for your platform")
Example #2
0
def _install_cli(pkg):
    """Install subcommand cli

    :param pkg: the package to install
    :type pkg: PackageVersion
    :rtype: None
    """

    with util.remove_path_on_error(_package_dir(pkg.name())) as pkg_dir:
        env_dir = os.path.join(pkg_dir, constants.DCOS_SUBCOMMAND_ENV_SUBDIR)

        resources = pkg.resource_json()

        if resources and resources.get("cli") is not None:
            binary = resources["cli"]
            binary_cli = _get_cli_binary_info(binary)
            _install_with_binary(
                pkg.name(),
                env_dir,
                binary_cli)
        elif pkg.command_json() is not None:
            install_operation = pkg.command_json()
            if 'pip' in install_operation:
                _install_with_pip(
                    pkg.name(),
                    env_dir,
                    install_operation['pip'])
            else:
                raise DCOSException(
                    "Installation methods '{}' not supported".format(
                        install_operation.keys()))
        else:
            raise DCOSException(
                "Could not find a CLI subcommand for your platform")