summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2004-04-13 03:46:05 (GMT)
committerSteven Knight <knight@baldmt.com>2004-04-13 03:46:05 (GMT)
commitc271fd87bcba82b535267c8c5e454615e2a4aa4f (patch)
tree78e53644e9c5ebc5de83171602f2f31b894179b7
parent088bb633e0ebcba2c8fea69a06bc426f3b1d27fb (diff)
downloadSCons-c271fd87bcba82b535267c8c5e454615e2a4aa4f.zip
SCons-c271fd87bcba82b535267c8c5e454615e2a4aa4f.tar.gz
SCons-c271fd87bcba82b535267c8c5e454615e2a4aa4f.tar.bz2
More robust searching for the ICL license file. (Gary Oberbrunner)
-rw-r--r--src/CHANGES.txt3
-rw-r--r--src/engine/SCons/Tool/icl.py29
-rw-r--r--test/import.py14
3 files changed, 44 insertions, 2 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index d7922ce..bf2c760 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -85,6 +85,9 @@ RELEASE 0.96 - XXX
are otherwise silently (and confusingly) turned into construction
variable overrides.
+ - Try to find the ICL license file path name in the external environment
+ and the registry before resorting to the hard-coded path name.
+
From Simon Perkins:
- Fix a bug introduced in building shared libraries under MinGW.
diff --git a/src/engine/SCons/Tool/icl.py b/src/engine/SCons/Tool/icl.py
index ec1e063..d59647c 100644
--- a/src/engine/SCons/Tool/icl.py
+++ b/src/engine/SCons/Tool/icl.py
@@ -38,6 +38,7 @@ import string
import SCons.Tool.msvc
import SCons.Util
+import SCons.Warnings
# Find Intel compiler:
# Could enumerate subkeys here to be more flexible.
@@ -99,7 +100,33 @@ def generate(env):
env['CXX'] = 'icl'
env['LINK'] = 'xilink'
- env['ENV']['INTEL_LICENSE_FILE'] = r'C:\Program Files\Common Files\Intel\Licenses'
+ # Look for license file dir.
+ envlicdir = os.environ.get("INTEL_LICENSE_FILE", '')
+ K = ('SOFTWARE\Intel\Licenses')
+ try:
+ k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, K)
+ reglicdir = SCons.Util.RegQueryValueEx(k, "w_cpp")[0]
+ except (AttributeError, SCons.Util.RegError):
+ reglicdir = ""
+ defaultlicdir = r'C:\Program Files\Common Files\Intel\Licenses'
+
+ licdir = None
+ for ld in [envlicdir, reglicdir]:
+ if ld and os.path.exists(ld):
+ licdir = ld
+ break
+ if not licdir:
+ licdir = defaultlicdir
+ if not os.path.exists(licdir):
+ class ICLLicenseDirWarning(SCons.Warnings.Warning):
+ pass
+ SCons.Warnings.enableWarningClass(ICLLicenseDirWarning)
+ SCons.Warnings.warn(ICLLicenseDirWarning,
+ "Intel license dir was not found."
+ " Tried using the INTEL_LICENSE_FILE environment variable (%s), the registry (%s) and the default path (%s)."
+ " Using the default path as a last resort."
+ % (envlicdir, reglicdir, defaultlicdir))
+ env['ENV']['INTEL_LICENSE_FILE'] = licdir
def exists(env):
try:
diff --git a/test/import.py b/test/import.py
index 6d154ae..48ae546 100644
--- a/test/import.py
+++ b/test/import.py
@@ -115,6 +115,13 @@ tools = [
'zip',
]
+error_output = {
+ 'icl' : """
+scons: warning: Intel license dir was not found. Tried using the INTEL_LICENSE_FILE environment variable (), the registry () and the default path (C:\Program Files\Common Files\Intel\Licenses). Using the default path as a last resort.
+File "SConstruct", line 1, in ?
+"""
+}
+
# An SConstruct for importing Tool names that have illegal characters
# for Python variable names.
indirect_import = """\
@@ -136,6 +143,11 @@ for tool in tools:
test.write('SConstruct', indirect_import % (tool, tool, tool))
else:
test.write('SConstruct', direct_import % (tool, tool, tool))
- test.run()
+ test.run(stderr=None)
+ stderr = test.stderr()
+ if stderr != '' and stderr != error_output.get(tool, ''):
+ print "Failed importing '%s', stderr:" % tool
+ print stderr
+ test.fail_test(1)
test.pass_test()