| # Copyright 2020 The IREE Authors |
| # Licensed under the Apache License v2.0 with LLVM Exceptions. |
| # See https://llvm.org/LICENSE.txt for license information. |
| # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| from typing import Sequence |
| PROD_DIGESTS_PATH = "build_tools/docker/prod_digests.txt".replace("/", os.sep) |
| capture_output: bool = False, |
| ) -> subprocess.CompletedProcess: |
| """Thin wrapper around subprocess.run""" |
| print(f"Running: `{' '.join(command)}`") |
| # Dummy CompletedProess with successful returncode. |
| return subprocess.CompletedProcess(command, returncode=0) |
| completed_process = subprocess.run( |
| command, text=text, check=check, capture_output=capture_output, **run_kwargs |
| def check_gcloud_auth(dry_run: bool = False): |
| # Ensure the user has the correct authorization if they try to push to GCR. |
| run_command(["which", "gcloud"]) |
| except subprocess.CalledProcessError as error: |
| "gcloud not found. See https://cloud.google.com/sdk/install for " |
| run_command(["gcloud", "auth", "configure-docker"], dry_run) |