def _set_up_gpg_env_vars_for_gpg_command(gpg_home_dir, gpg_command_args):
    """Produce a new command arguments that set required GPG env vars before running the command."""
    result = [
        "env",
        "-u",
        "GPG_AGENT_INFO",  # There should not be a GPG agent on the system, unset the env var.
        "GNUPGHOME={}".format(gpg_home_dir),  # Tell GPG where to look for keys and trust info.
    ]
    result.extend(gpg_command_args)
    result.append("--batch")  # Use batch mode so that no interactive commands are used
    return result