Skip to content

Commit

Permalink
No longer call ENV.userpaths! in requirements
Browse files Browse the repository at this point in the history
Instead we use which with a custom PATH.
  • Loading branch information
jacknagel committed Aug 19, 2013
1 parent a1ce0db commit e1b6ebb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
9 changes: 5 additions & 4 deletions Library/Homebrew/requirement.rb
Expand Up @@ -94,6 +94,10 @@ def infer_env_modification(o)
end
end

def which(cmd)
super(cmd, ORIGINAL_PATHS.join(File::PATH_SEPARATOR))
end

class << self
attr_rw :fatal, :build, :default_formula

Expand All @@ -118,10 +122,7 @@ def yielder
if instance_variable_defined?(:@satisfied)
@satisfied
elsif @options[:build_env]
ENV.with_build_environment do
ENV.userpaths!
yield @proc
end
ENV.with_build_environment { yield @proc }
else
yield @proc
end
Expand Down
4 changes: 0 additions & 4 deletions Library/Homebrew/test/test_requirement.rb
Expand Up @@ -50,12 +50,10 @@ def test_satisfy_with_boolean

def test_satisfy_sets_up_build_env_by_default
req = Class.new(Requirement) do
env :userpaths
satisfy { true }
end.new

ENV.expects(:with_build_environment).yields.returns(true)
ENV.expects(:userpaths!)

assert req.satisfied?
end
Expand All @@ -66,7 +64,6 @@ def test_satisfy_build_env_can_be_disabled
end.new

ENV.expects(:with_build_environment).never
ENV.expects(:userpaths!).never

assert req.satisfied?
end
Expand All @@ -78,7 +75,6 @@ def test_infers_path_from_satisfy_result
end.new

ENV.expects(:with_build_environment).yields.returns(which_path)
ENV.expects(:userpaths!)
ENV.expects(:append).with("PATH", which_path.parent, ":")

req.satisfied?
Expand Down

0 comments on commit e1b6ebb

Please sign in to comment.