diff --git a/Library/Homebrew/python_helper.rb b/Library/Homebrew/python_helper.rb index 3fd501bb2b..c99fce2c74 100644 --- a/Library/Homebrew/python_helper.rb +++ b/Library/Homebrew/python_helper.rb @@ -35,15 +35,11 @@ def python_helper(options={:allowed_major_versions => [2, 3]}, &block) filtered_python_reqs = [] while !python_reqs.empty? py = python_reqs.shift - # this is ulgy but Ruby 1.8 has no `uniq! { }` - if !filtered_python_reqs.map{ |fpr| fpr.binary }.include?(py.binary) && - py.satisfied? && - options[:allowed_major_versions].include?(py.version.major) && - # if optional or recommended then check the build.with? - (self.build.with?(py.name) || !(py.optional? || py.recommended?)) - then - filtered_python_reqs << py - end + next if filtered_python_reqs.any? { |req| req.binary == py.binary } + next unless py.satisfied? + next unless options[:allowed_major_versions].include?(py.version.major) + next if (py.optional? || py.recommended?) && build.without?(py.name) + filtered_python_reqs << py end # Allow to use an else-branch like so: `if python do ... end; else ... end`