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
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
def run_post_install(formula)

View File

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