only run post_install if it's defined

Closes Homebrew/homebrew#42593.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Xu Cheng 2015-08-07 13:56:12 +08:00
parent 8fecd4c198
commit e60dc64828
2 changed files with 8 additions and 6 deletions

View File

@ -2,7 +2,7 @@ require "sandbox"
module Homebrew module Homebrew
def postinstall def postinstall
ARGV.resolved_formulae.each { |f| run_post_install(f) } ARGV.resolved_formulae.select(&:post_install_defined?).each { |f| run_post_install(f) }
end end
def run_post_install(formula) def run_post_install(formula)

View File

@ -400,12 +400,14 @@ class FormulaInstaller
link(keg) link(keg)
fix_install_names(keg) fix_install_names(keg)
if build_bottle? && formula.post_install_defined? if formula.post_install_defined?
if build_bottle?
ohai "Not running post_install as we're building a bottle" ohai "Not running post_install as we're building a bottle"
puts "You can run it manually using `brew postinstall #{formula.full_name}`" puts "You can run it manually using `brew postinstall #{formula.full_name}`"
else else
post_install post_install
end end
end
ohai "Summary" if verbose? || show_summary_heading? ohai "Summary" if verbose? || show_summary_heading?
puts summary puts summary