No longer call ENV.userpaths! in requirements
Instead we use which with a custom PATH.
This commit is contained in:
parent
e0574b854e
commit
a03120868f
@ -94,6 +94,10 @@ class Requirement
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def which(cmd)
|
||||||
|
super(cmd, ORIGINAL_PATHS.join(File::PATH_SEPARATOR))
|
||||||
|
end
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
attr_rw :fatal, :build, :default_formula
|
attr_rw :fatal, :build, :default_formula
|
||||||
|
|
||||||
@ -118,10 +122,7 @@ class Requirement
|
|||||||
if instance_variable_defined?(:@satisfied)
|
if instance_variable_defined?(:@satisfied)
|
||||||
@satisfied
|
@satisfied
|
||||||
elsif @options[:build_env]
|
elsif @options[:build_env]
|
||||||
ENV.with_build_environment do
|
ENV.with_build_environment { yield @proc }
|
||||||
ENV.userpaths!
|
|
||||||
yield @proc
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
yield @proc
|
yield @proc
|
||||||
end
|
end
|
||||||
|
@ -50,12 +50,10 @@ class RequirementTests < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_satisfy_sets_up_build_env_by_default
|
def test_satisfy_sets_up_build_env_by_default
|
||||||
req = Class.new(Requirement) do
|
req = Class.new(Requirement) do
|
||||||
env :userpaths
|
|
||||||
satisfy { true }
|
satisfy { true }
|
||||||
end.new
|
end.new
|
||||||
|
|
||||||
ENV.expects(:with_build_environment).yields.returns(true)
|
ENV.expects(:with_build_environment).yields.returns(true)
|
||||||
ENV.expects(:userpaths!)
|
|
||||||
|
|
||||||
assert req.satisfied?
|
assert req.satisfied?
|
||||||
end
|
end
|
||||||
@ -66,7 +64,6 @@ class RequirementTests < Test::Unit::TestCase
|
|||||||
end.new
|
end.new
|
||||||
|
|
||||||
ENV.expects(:with_build_environment).never
|
ENV.expects(:with_build_environment).never
|
||||||
ENV.expects(:userpaths!).never
|
|
||||||
|
|
||||||
assert req.satisfied?
|
assert req.satisfied?
|
||||||
end
|
end
|
||||||
@ -78,7 +75,6 @@ class RequirementTests < Test::Unit::TestCase
|
|||||||
end.new
|
end.new
|
||||||
|
|
||||||
ENV.expects(:with_build_environment).yields.returns(which_path)
|
ENV.expects(:with_build_environment).yields.returns(which_path)
|
||||||
ENV.expects(:userpaths!)
|
|
||||||
ENV.expects(:append).with("PATH", which_path.parent, ":")
|
ENV.expects(:append).with("PATH", which_path.parent, ":")
|
||||||
|
|
||||||
req.satisfied?
|
req.satisfied?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user