From 1759abcc579bbd602f5ea5d59cfbdcb8a4e94fea Mon Sep 17 00:00:00 2001
From: Tobias Markmann <tm@ayena.de>
Date: Mon, 25 Jul 2016 15:01:27 +0200
Subject: Improve Qt detection on Linux by setting correct environment

Pass along current scons process environment to the Popen
call that detects Qt MOC version. This is required for Linux
distributions that use qtchooser.

This fixes building Swift on Gentoo.

Test-Information.

None.

Change-Id: I8a1f18af5b8a7bdfe86b262ab38088d0700aab8d

diff --git a/BuildTools/SCons/Tools/qt4.py b/BuildTools/SCons/Tools/qt4.py
index 0e248d9..f3678d7 100644
--- a/BuildTools/SCons/Tools/qt4.py
+++ b/BuildTools/SCons/Tools/qt4.py
@@ -209,7 +209,7 @@ def _detect(env):
         moc = env.WhereIs('moc-qt4') or env.WhereIs('moc4') or env.WhereIs('moc')
     if moc:
         # Test whether the moc command we found is real, or whether it is just the qtchooser dummy.
-        p = subprocess.Popen([moc, "-v"], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+        p = subprocess.Popen([moc, "-v"], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=env["ENV"])
         p.communicate()
         if p.returncode == 0:
             import sys
-- 
cgit v0.10.2-6-g49f6