Mesa (master): scons: fix llvm detection
Brian Paul
brianp at kemper.freedesktop.org
Thu May 20 16:28:12 UTC 2010
Module: Mesa
Branch: master
Commit: 5c682485b872537277951a1f6418d97d211a2651
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=5c682485b872537277951a1f6418d97d211a2651
Author: Brian Paul <brianp at vmware.com>
Date: Thu May 20 10:25:17 2010 -0600
scons: fix llvm detection
The test for env['platform'] caused an exception since 'env' is not
defined at that point. Instead, determine the target platform by
scanning sys.argv[].
---
common.py | 12 +++++++++++-
1 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/common.py b/common.py
index 300e91a..e396ad9 100644
--- a/common.py
+++ b/common.py
@@ -3,6 +3,7 @@
import os
import os.path
+import re
import subprocess
import sys
import platform as _platform
@@ -37,9 +38,18 @@ default_machine = _machine_map.get(default_machine, 'generic')
if 'LLVM' in os.environ:
default_llvm = 'yes'
else:
+ # Search sys.argv[] for a "platform=foo" argument since we don't have
+ # an 'env' variable at this point.
+ platform = default_platform
+ pattern = re.compile("(platform=)(.*)")
+ for arg in sys.argv:
+ m = pattern.match(arg)
+ if m:
+ platform = m.group(2)
+
default_llvm = 'no'
try:
- if env['platform'] != 'windows' and subprocess.call(['llvm-config', '--version'], stdout=subprocess.PIPE) == 0:
+ if platform != 'windows' and subprocess.call(['llvm-config', '--version'], stdout=subprocess.PIPE) == 0:
default_llvm = 'yes'
except:
pass
More information about the mesa-commit
mailing list