From 49cf589d13237f9ccdc0ae384bf40d3776065bb7 Mon Sep 17 00:00:00 2001 From: Steven Knight Date: Mon, 10 Oct 2005 04:22:54 +0000 Subject: Improve intelc.py so it doesn't throw an exception if a version other than ia32 (for example, em64t) is installed without the ia32 version. (Anonymous) --- src/CHANGES.txt | 3 +++ src/engine/SCons/Tool/intelc.py | 37 ++++++++++++++++++++++++------------- test/import.py | 22 ++++++++++++++++------ 3 files changed, 43 insertions(+), 19 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index 2312d58..97a4bcd 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -17,6 +17,9 @@ RELEASE 0.97 - XXX - Fix a typo in the man page description of PathIsDirCreate. + - Fix the intelc.py Tool module to not throw an exception if the + only installed version is something other than ia32. + From Chad Austin: - Allow Help() to be called multiple times, appending to the help diff --git a/src/engine/SCons/Tool/intelc.py b/src/engine/SCons/Tool/intelc.py index 921bcee..9499205 100644 --- a/src/engine/SCons/Tool/intelc.py +++ b/src/engine/SCons/Tool/intelc.py @@ -86,11 +86,17 @@ def check_abi(abi): abi = abi.lower() # valid_abis maps input name to canonical name if is_win32: - valid_abis = {'ia32':'ia32', 'x86':'ia32', - 'ia64':'ia64'} + valid_abis = {'ia32' : 'ia32', + 'x86' : 'ia32', + 'ia64' : 'ia64', + 'em64t' : 'ia32e', + 'amd64' : 'ia32e'} if is_linux: - valid_abis = {'ia32':'ia32', 'x86':'ia32', - 'x86_64':'x86_64', 'em64t':'x86_64', 'amd64':'x86_64'} + valid_abis = {'ia32' : 'ia32', + 'x86' : 'ia32', + 'x86_64' : 'x86_64', + 'em64t' : 'x86_64', + 'amd64' : 'x86_64'} try: abi = valid_abis[abi] except KeyError: @@ -125,14 +131,13 @@ def get_intel_registry_value(valuename, version=None, abi=None): """ Return a value from the Intel compiler registry tree. (Win32 only) """ - # Open the key: K = 'Software\\Intel\\Compilers\\C++\\' + version + '\\'+abi.upper() try: k = SCons.Util.RegOpenKeyEx(SCons.Util.HKEY_LOCAL_MACHINE, K) except SCons.Util.RegError: raise MissingRegistryError, \ - "%s was not found in the registry, for Intel compiler version %s"%(K, version) + "%s was not found in the registry, for Intel compiler version %s, abi='%s'"%(K, version,abi) # Get the value: try: @@ -167,7 +172,7 @@ def get_all_compiler_versions(): # than uninstalling properly), so the registry values # are still there. ok = False - for try_abi in ('IA32', 'IA64'): + for try_abi in ('IA32', 'IA32e', 'IA64'): try: d = get_intel_registry_value('ProductDir', subkey, try_abi) except MissingRegistryError: @@ -201,12 +206,10 @@ def get_intel_compiler_top(version, abi): The compiler will be in /bin/icl.exe (icc on linux), the include dir is /include, etc. """ - if is_win32: if not SCons.Util.can_read_reg: raise NoRegistryModuleError, "No Windows registry module was found" top = get_intel_registry_value('ProductDir', version, abi) - if not os.path.exists(os.path.join(top, "Bin", "icl.exe")): raise MissingDirError, \ "Can't find Intel compiler in %s"%(top) @@ -245,7 +248,7 @@ def generate(env, version=None, abi=None, topdir=None, verbose=0): SCons.Tool.msvc.generate(env) elif is_linux: SCons.Tool.gcc.generate(env) - + # if version is unspecified, use latest vlist = get_all_compiler_versions() if not version: @@ -285,14 +288,22 @@ def generate(env, version=None, abi=None, topdir=None, verbose=0): if not topdir: # Normally this is an error, but it might not be if the compiler is # on $PATH and the user is importing their env. + class ICLTopDirWarning(SCons.Warnings.Warning): + pass if is_linux and not env.Detect('icc') or \ is_win32 and not env.Detect('icl'): - class ICLTopDirWarning(SCons.Warnings.Warning): - pass + SCons.Warnings.enableWarningClass(ICLTopDirWarning) SCons.Warnings.warn(ICLTopDirWarning, - "Can't find Intel compiler top dir for version='%s', abi='%s'"% + "Failed to find Intel compiler for version='%s', abi='%s'"% (str(version), str(abi))) + else: + # should be cleaned up to say what this other version is + # since in this case we have some other Intel compiler installed + SCons.Warnings.enableWarningClass(ICLTopDirWarning) + SCons.Warnings.warn(ICLTopDirWarning, + "Can't find Intel compiler top dir for version='%s', abi='%s'"% + (str(version), str(abi))) if topdir: if verbose: diff --git a/test/import.py b/test/import.py index 0c790ba..7bcc058 100644 --- a/test/import.py +++ b/test/import.py @@ -135,18 +135,24 @@ tools = [ 'zip', ] -# Intel no top dir warning, 32 bit version. -intel_no_top_dir_32_warning = """ -scons: warning: Can't find Intel compiler top dir for version='None', abi='ia32' +# Intel no compiler warning.. +intel_no_compiler_fmt = """ +scons: warning: Failed to find Intel compiler for version='None', abi='%s' File "SConstruct", line 1, in ? """ -# Intel no top dir warning, 64 bit version. -intel_no_top_dir_64_warning = """ -scons: warning: Can't find Intel compiler top dir for version='None', abi='x86_64' +intel_no_compiler_32_warning = intel_no_compiler_fmt % 'ia32' +intel_no_compiler_64_warning = intel_no_compiler_fmt % 'x86_64' + +# Intel no top dir warning. +intel_no_top_dir_fmt = """ +scons: warning: Can't find Intel compiler top dir for version='None', abi='%s' File "SConstruct", line 1, in ? """ +intel_no_top_dir_32_warning = intel_no_top_dir_fmt % 'ia32' +intel_no_top_dir_64_warning = intel_no_top_dir_fmt % 'x86_64' + # Intel no license directory warning intel_license_warning = """ 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. @@ -155,6 +161,10 @@ File "SConstruct", line 1, in ? intel_warnings = [ intel_license_warning, + intel_no_compiler_32_warning, + intel_no_compiler_32_warning + intel_license_warning, + intel_no_compiler_64_warning, + intel_no_compiler_64_warning + intel_license_warning, intel_no_top_dir_32_warning, intel_no_top_dir_32_warning + intel_license_warning, intel_no_top_dir_64_warning, -- cgit v0.12