コード例 #1
0
def _update_agent_config(ctx: Context):
    """
    Update agent configurations.

    :param ctx: the context.
    :return: None
    """
    # update aea_version in case current framework version is different
    version = Version(aea.__version__)
    if not ctx.agent_config.aea_version_specifiers.contains(version):
        new_aea_version = compute_specifier_from_version(version)
        old_aea_version = ctx.agent_config.aea_version
        click.echo(
            f"Updating AEA version specifier from {old_aea_version} to {new_aea_version}."
        )
        ctx.agent_config.aea_version = new_aea_version

    # update author name if it is different
    cli_author = ctx.config.get("cli_author")
    if cli_author and ctx.agent_config.author != cli_author:
        click.echo(
            f"Updating author from {ctx.agent_config.author} to {cli_author}")
        ctx.agent_config._author = cli_author  # pylint: disable=protected-access
        ctx.agent_config.version = DEFAULT_VERSION

    ctx.dump_agent_config()
コード例 #2
0
ファイル: upgrade.py プロジェクト: zeta1999/agents-aea
def update_agent_config(ctx: Context) -> None:
    """
    Update agent configurations.

    In particular:
    - update aea_version in case current framework version is different
    - update author name if it is different

    :param ctx: the context.
    :return: None
    """
    update_aea_version_range(ctx.agent_config)
    cli_author = ctx.config.get("cli_author")
    if cli_author and ctx.agent_config.author != cli_author:
        click.echo(
            f"Updating author from {ctx.agent_config.author} to {cli_author}")
        ctx.agent_config._author = cli_author  # pylint: disable=protected-access
        ctx.agent_config.version = DEFAULT_VERSION

    ctx.dump_agent_config()