Repository: google/OpenSK
File: deploy.py (Python)

Code before:
          env=env,
          cwd=cwd).stdout
    except subprocess.CalledProcessError as e:
      fatal("Failed to execute {}: {}".format(cmd[0], str(e)))
      # Unreachable because fatal() will exit
    return cmd_output.decode()

  def update_rustc_if_needed(self):
    target_toolchain_fullstring = "stable"
    with open("rust-toolchain", "r") as f:
      target_toolchain_fullstring = f.readline().strip()
    target_toolchain = target_toolchain_fullstring.split("-", maxsplit=1)
    if len(target_toolchain) == 1:
      # If we target the stable version of rust, we won't have a date
      # associated to the version and split will only return 1 item.
      # To avoid failing later when accessing the date, we insert an
      # empty value.
      target_toolchain.append("")
    current_version = self.checked_command_output(["rustc", "--version"])
    if not (target_toolchain[0] in current_version and
            target_toolchain[1] in current_version):
      info("Updating rust toolchain to {}".format("-".join(target_toolchain)))
      # Need to update
      rustup_install = ["rustup"]
      if self.args.verbose_build:
        rustup_install.extend(["--verbose"])
      rustup_install.extend(["install", target_toolchain_fullstring])
      self.checked_command(rustup_install)

    rustup_target = ["rustup"]
    if self.args.verbose_build:
      rustup_target.extend(["--verbose"])
    rustup_target.extend(
        ["target", "add", SUPPORTED_BOARDS[self.args.board].arch])
    self.checked_command(rustup_target)
    info("Rust toolchain up-to-date")

  def build_tockos(self):
    info("Building Tock OS for board {}".format(self.args.board))
    props = SUPPORTED_BOARDS[self.args.board]
    out_directory = os.path.join("third_party", "tock", "target", props.arch,
                                 "release")
    os.makedirs(out_directory, exist_ok=True)

    env = os.environ.copy()
    if self.args.verbose_build:
      env["V"] = "1"
    self.checked_command(["make"], cwd=props.path, env=env)

  def build_example(self):
    info("Building example {}".format(self.args.application))

Review comment (suggestion):
no need to create a list for 1 element.
```python
rustup_install.append("--verbose")
```
should do the job.

Code after:
          env=env,
          cwd=cwd).stdout
    except subprocess.CalledProcessError as e:
      fatal("Failed to execute {}: {}".format(cmd[0], str(e)))
      # Unreachable because fatal() will exit
    return cmd_output.decode()

  def update_rustc_if_needed(self):
    target_toolchain_fullstring = "stable"
    with open("rust-toolchain", "r") as f:
      target_toolchain_fullstring = f.readline().strip()
    target_toolchain = target_toolchain_fullstring.split("-", maxsplit=1)
    if len(target_toolchain) == 1:
      # If we target the stable version of rust, we won't have a date
      # associated to the version and split will only return 1 item.
      # To avoid failing later when accessing the date, we insert an
      # empty value.
      target_toolchain.append("")
    current_version = self.checked_command_output(["rustc", "--version"])
    if not (target_toolchain[0] in current_version and
            target_toolchain[1] in current_version):
      info("Updating rust toolchain to {}".format("-".join(target_toolchain)))
      # Need to update
      rustup_install = ["rustup"]
      if self.args.verbose_build:
        rustup_install.append("--verbose")
      rustup_install.extend(["install", target_toolchain_fullstring])
      self.checked_command(rustup_install)

    rustup_target = ["rustup"]
    if self.args.verbose_build:
      rustup_target.append("--verbose")
    rustup_target.extend(
        ["target", "add", SUPPORTED_BOARDS[self.args.board].arch])
    self.checked_command(rustup_target)
    info("Rust toolchain up-to-date")

  def build_tockos(self):
    info("Building Tock OS for board {}".format(self.args.board))
    props = SUPPORTED_BOARDS[self.args.board]
    out_directory = os.path.join("third_party", "tock", "target", props.arch,
                                 "release")
    os.makedirs(out_directory, exist_ok=True)

    env = os.environ.copy()
    if self.args.verbose_build:
      env["V"] = "1"
    self.checked_command(["make"], cwd=props.path, env=env)

  def build_example(self):
    info("Building example {}".format(self.args.application))