From 71063aa2e39ed12a6e42ebd7e66d477b3baa02c8 Mon Sep 17 00:00:00 2001
From: Alex Wang <aw1621107@gmail.com>
Date: Tue, 13 Sep 2016 12:36:56 -0400
Subject: [PATCH] Make scons use stdenv only if immediate build dep

formula_installer will use stdenv if scons is anywhere in the formula's
recursive dependency list:

    https://github.com/Homebrew/legacy-homebrew/issues/40401#issuecomment-110066355

Having scons as a dependency should only require stdenv if it is an
immediate build dependency, as otherwise scons shouldn't be invoked.
---
 Library/Homebrew/formula_installer.rb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Library/Homebrew/formula_installer.rb b/Library/Homebrew/formula_installer.rb
index 68c02aee39..cb62e62068 100644
--- a/Library/Homebrew/formula_installer.rb
+++ b/Library/Homebrew/formula_installer.rb
@@ -562,7 +562,7 @@ class FormulaInstaller
 
     if ARGV.env
       args << "--env=#{ARGV.env}"
-    elsif formula.env.std? || formula.recursive_dependencies.any? { |d| d.name == "scons" }
+    elsif formula.env.std? || formula.deps.select(&:build?).any? { |d| d.name == "scons" }
       args << "--env=std"
     end
 
-- 
GitLab