Fix unbottled dependency handling

- Rename `BuildToolsError` to `UnbottledError` to better reflect what it
  does (particularly now)
- Improve the `UnbottledError` messaging
- Raise the `UnbottledError` for dependencies also when building bottles
  (so that we don't try and build bottles against things that have been
  built from source).
This commit is contained in:
Mike McQuaid
2020-12-11 16:57:47 +00:00
parent 2be340c6d6
commit eb74717a9e
3 changed files with 24 additions and 21 deletions
+9 -8
View File
@@ -488,17 +488,18 @@ class BuildError < RuntimeError
end
end
# Raised by {FormulaInstaller#check_dependencies_bottled} and
# {FormulaInstaller#install} if the formula or its dependencies are not bottled
# and are being installed on a system without necessary build tools.
class BuildToolsError < RuntimeError
# Raised if the formula or its dependencies are not bottled and are being
# installed in a situation where a bottle is required.
class UnbottledError < RuntimeError
def initialize(formulae)
super <<~EOS
The following #{"formula".pluralize(formulae.count)}
msg = +<<~EOS
The following #{"formula".pluralize(formulae.count)} cannot be installed from #{"bottle".pluralize(formulae.count)} and must be
built from source.
#{formulae.to_sentence}
cannot be installed as #{"binary package".pluralize(formulae.count)} and must be built from source.
#{DevelopmentTools.installation_instructions}
EOS
msg += "#{DevelopmentTools.installation_instructions}\n" unless DevelopmentTools.installed?
msg.freeze
super(msg)
end
end