formula_installer: tweak no-bottle error message

Follow up to #10183.

This improves the error message displayed when `formula.pour_bottle?` is
false.

Before:

    ❯ brew install python@3.8
    Error: python@3.8: no bottle available!
    The bottle needs the Apple Command Line Tools to be installed.
      You can install them, if desired, with:
        xcode-select --install
    You can try to install from source with e.g.
      brew install --build-from-source python@3.8
    Please note building from source is unsupported. You will encounter build
    failures with some formulae. If you experience any issues please create pull
    requests instead of asking for help on Homebrew's GitHub, Twitter or any other
    official channels.

After:

    ❯ brew install python@3.8
    Error: python@3.8: the bottle needs the Apple Command Line Tools to be installed.
      You can install them, if desired, with:
        xcode-select --install
    You can try to install from source with e.g.
      brew install --build-from-source python@3.8
    Please note building from source is unsupported. You will encounter build
    failures with some formulae. If you experience any issues please create pull
    requests instead of asking for help on Homebrew's GitHub, Twitter or any other
    official channels.
This commit is contained in:
carlocab 2021-01-01 19:51:40 +00:00 committed by Carlo Cabrera
parent fe01a9f410
commit beeb7faaba
No known key found for this signature in database
GPG Key ID: C74D447FC549A1D0

View File

@ -242,14 +242,18 @@ class FormulaInstaller
# Integration tests override homebrew-core locations
ENV["HOMEBREW_TEST_TMPDIR"].nil? &&
!pour_bottle?
message = <<~EOS
message = if !formula.pour_bottle? && formula.pour_bottle_check_unsatisfied_reason
formula_message = formula.pour_bottle_check_unsatisfied_reason
formula_message[0] = formula_message[0].downcase
"#{formula}: #{formula_message}"
else
<<~EOS
#{formula}: no bottle available!
EOS
if !formula.pour_bottle? && formula.pour_bottle_check_unsatisfied_reason
message += formula.pour_bottle_check_unsatisfied_reason
end
message += <<~EOS
You can try to install from source with e.g.
You can try to install from source with:
brew install --build-from-source #{formula}
Please note building from source is unsupported. You will encounter build
failures with some formulae. If you experience any issues please create pull