From beeb7faaba3f5337eb7e7e74c5f55747f13505b1 Mon Sep 17 00:00:00 2001 From: carlocab <30379873+carlocab@users.noreply.github.com> Date: Fri, 1 Jan 2021 19:51:40 +0000 Subject: [PATCH] formula_installer: tweak no-bottle error message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- Library/Homebrew/formula_installer.rb | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb index ad3036938e..726f42c944 100644 --- a/Library/Homebrew/formula_installer.rb +++ b/Library/Homebrew/formula_installer.rb @@ -242,14 +242,18 @@ class FormulaInstaller # Integration tests override homebrew-core locations ENV["HOMEBREW_TEST_TMPDIR"].nil? && !pour_bottle? - message = <<~EOS - #{formula}: no bottle available! - EOS - if !formula.pour_bottle? && formula.pour_bottle_check_unsatisfied_reason - message += formula.pour_bottle_check_unsatisfied_reason + 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 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