From 4e65b33c1d40bb2c243f775f388056aed31d8671 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Wed, 31 Jan 2018 11:48:43 +0200 Subject: third_party:waf: update to upstream 2.0.4 release Update third_party/waf/ to 2.0.4 to bring us closer to Python 3 This change requires a number of changes in buildtools/ too. Signed-off-by: Alexander Bokovoy Reviewed-by: Andrew Bartlett --- third_party/waf/waflib/Tools/ifort.py | 39 +++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'third_party/waf/waflib/Tools/ifort.py') diff --git a/third_party/waf/waflib/Tools/ifort.py b/third_party/waf/waflib/Tools/ifort.py index 636d863fee2..3d0f83f0732 100644 --- a/third_party/waf/waflib/Tools/ifort.py +++ b/third_party/waf/waflib/Tools/ifort.py @@ -5,9 +5,9 @@ #! /usr/bin/env python # encoding: utf-8 # DC 2008 -# Thomas Nagy 2016 (ita) +# Thomas Nagy 2016-2018 (ita) -import os, re +import os, re, traceback from waflib import Utils, Logs, Errors from waflib.Tools import fc, fc_config, fc_scan, ar, ccroot from waflib.Configure import conf @@ -80,7 +80,7 @@ def configure(conf): Detects the Intel Fortran compilers """ if Utils.is_win32: - compiler, version, path, includes, libdirs, arch = conf.detect_ifort(True) + compiler, version, path, includes, libdirs, arch = conf.detect_ifort() v = conf.env v.DEST_CPU = arch v.PATH = path @@ -89,8 +89,7 @@ def configure(conf): v.MSVC_COMPILER = compiler try: v.MSVC_VERSION = float(version) - except Exception: - raise + except ValueError: v.MSVC_VERSION = float(version[:-3]) conf.find_ifort_win32() @@ -115,32 +114,34 @@ def gather_ifort_versions(conf, versions): version_pattern = re.compile('^...?.?\....?.?') try: all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Intel\\Compilers\\Fortran') - except WindowsError: + except OSError: try: all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Intel\\Compilers\\Fortran') - except WindowsError: + except OSError: return index = 0 while 1: try: version = Utils.winreg.EnumKey(all_versions, index) - except WindowsError: + except OSError: break index += 1 if not version_pattern.match(version): continue targets = {} for target,arch in all_ifort_platforms: - if target=='intel64': targetDir='EM64T_NATIVE' - else: targetDir=target + if target=='intel64': + targetDir='EM64T_NATIVE' + else: + targetDir=target try: Utils.winreg.OpenKey(all_versions,version+'\\'+targetDir) icl_version=Utils.winreg.OpenKey(all_versions,version) path,type=Utils.winreg.QueryValueEx(icl_version,'ProductDir') - except WindowsError: + except OSError: pass else: - batch_file=os.path.join(path,'bin','iclvars.bat') + batch_file=os.path.join(path,'bin','ifortvars.bat') if os.path.isfile(batch_file): targets[target] = target_compiler(conf, 'intel', arch, version, target, batch_file) @@ -148,10 +149,10 @@ def gather_ifort_versions(conf, versions): try: icl_version = Utils.winreg.OpenKey(all_versions, version+'\\'+target) path,type = Utils.winreg.QueryValueEx(icl_version,'ProductDir') - except WindowsError: + except OSError: continue else: - batch_file=os.path.join(path,'bin','iclvars.bat') + batch_file=os.path.join(path,'bin','ifortvars.bat') if os.path.isfile(batch_file): targets[target] = target_compiler(conf, 'intel', arch, version, target, batch_file) major = version[0:2] @@ -235,11 +236,11 @@ echo LIB=%%LIB%%;%%LIBPATH%% try: conf.cmd_and_log(fc + ['/help'], env=env) except UnicodeError: - st = Utils.ex_stack() + st = traceback.format_exc() if conf.logger: conf.logger.error(st) conf.fatal('ifort: Unicode error - check the code page?') - except Exception ,e: + except Exception as e: Logs.debug('ifort: get_ifort_version: %r %r %r -> failure %s', compiler, version, target, str(e)) conf.fatal('ifort: cannot run the compiler in get_ifort_version (run with -v to display errors)') else: @@ -281,7 +282,7 @@ class target_compiler(object): return self.is_done = True try: - vs = self.conf.get_msvc_version(self.compiler, self.version, self.bat_target, self.bat) + vs = self.conf.get_ifort_version_win32(self.compiler, self.version, self.bat_target, self.bat) except Errors.ConfigurationError: self.is_valid = False return @@ -338,7 +339,8 @@ def find_ifort_win32(conf): # before setting anything, check if the compiler is really intel fortran env = dict(conf.environ) - if path: env.update(PATH = ';'.join(path)) + if path: + env.update(PATH = ';'.join(path)) if not conf.cmd_and_log(fc + ['/nologo', '/help'], env=env): conf.fatal('not intel fortran compiler could not be identified') @@ -412,3 +414,4 @@ def apply_manifest_ifort(self): man_node = out_node.parent.find_or_declare(out_node.name + '.manifest') self.link_task.outputs.append(man_node) self.env.DO_MANIFEST = True + -- cgit v1.2.1