mirror of https://gitlab.com/ita1024/waf.git
remove more except: lines
This commit is contained in:
parent
63d3442ad2
commit
b5bb54ede7
|
@ -21,7 +21,7 @@ def get_extensions(lst):
|
|||
if not isinstance(x, str):
|
||||
x = x.name
|
||||
ret.append(x[x.rfind('.') + 1:])
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return ret
|
||||
|
||||
|
|
|
@ -695,22 +695,22 @@ def run_c_code(self, *k, **kw):
|
|||
|
||||
try:
|
||||
os.makedirs(dir)
|
||||
except:
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
try:
|
||||
os.stat(dir)
|
||||
except:
|
||||
except OSError:
|
||||
self.fatal('cannot use the configuration test folder %r' % dir)
|
||||
|
||||
cachemode = getattr(Options.options, 'confcache', None)
|
||||
if cachemode == CACHE_RESULTS:
|
||||
try:
|
||||
proj = ConfigSet.ConfigSet(os.path.join(dir, 'cache_run_c_code'))
|
||||
ret = proj['cache_run_c_code']
|
||||
except:
|
||||
except OSError:
|
||||
pass
|
||||
else:
|
||||
ret = proj['cache_run_c_code']
|
||||
if isinstance(ret, str) and ret.startswith('Test does not build'):
|
||||
self.fatal(ret)
|
||||
return ret
|
||||
|
@ -1139,7 +1139,7 @@ class cfgtask(Task.TaskBase):
|
|||
bld.logger = self.logger
|
||||
try:
|
||||
bld.check(**self.args)
|
||||
except:
|
||||
except Exception:
|
||||
return 1
|
||||
|
||||
@conf
|
||||
|
|
|
@ -812,7 +812,7 @@ class c_parser(object):
|
|||
"""
|
||||
try:
|
||||
nd = node.ctx.cache_nd
|
||||
except:
|
||||
except AttributeError:
|
||||
nd = node.ctx.cache_nd = {}
|
||||
|
||||
tup = (node, filename)
|
||||
|
@ -987,7 +987,7 @@ class c_parser(object):
|
|||
elif token == 'define':
|
||||
try:
|
||||
self.defs[define_name(line)] = line
|
||||
except:
|
||||
except Exception:
|
||||
raise PreprocError("Invalid define line %s" % line)
|
||||
elif token == 'undef':
|
||||
m = re_mac.match(line)
|
||||
|
|
|
@ -252,7 +252,7 @@ def use_rec(self, name, **kw):
|
|||
for x in self.to_list(getattr(y, 'use', [])):
|
||||
try:
|
||||
p[x].append(name)
|
||||
except:
|
||||
except KeyError:
|
||||
p[x] = [name]
|
||||
self.use_rec(x, objects=objects, stlib=stlib)
|
||||
|
||||
|
@ -334,7 +334,7 @@ def process_use(self):
|
|||
for x in names:
|
||||
try:
|
||||
y = self.bld.get_tgen_by_name(x)
|
||||
except:
|
||||
except Exception:
|
||||
if not self.env['STLIB_' + x] and not x in self.uselib:
|
||||
self.uselib.append(x)
|
||||
else:
|
||||
|
|
|
@ -36,7 +36,7 @@ def check_same_targets(self):
|
|||
mp[node].append(tsk)
|
||||
try:
|
||||
uids[tsk.uid()].append(tsk)
|
||||
except:
|
||||
except KeyError:
|
||||
uids[tsk.uid()] = [tsk]
|
||||
|
||||
for g in self.groups:
|
||||
|
|
|
@ -311,7 +311,7 @@ def check_fortran_clib(self, autoadd=True, *k, **kw):
|
|||
features = 'fc fcprogram_test',
|
||||
linkflags = [self.env.FC_VERBOSE_FLAG]
|
||||
)
|
||||
except:
|
||||
except Exception:
|
||||
self.end_msg(False)
|
||||
if kw.get('mandatory', True):
|
||||
conf.fatal('Could not find the c library flags')
|
||||
|
|
|
@ -23,7 +23,7 @@ def find_irixcc(conf):
|
|||
|
||||
try:
|
||||
conf.cmd_and_log(cc + ['-version'])
|
||||
except:
|
||||
except Exception:
|
||||
conf.fatal('%r -version could not be executed' % cc)
|
||||
|
||||
v['CC'] = cc
|
||||
|
|
|
@ -122,7 +122,7 @@ def use_javac_files(self):
|
|||
for x in names:
|
||||
try:
|
||||
y = get(x)
|
||||
except:
|
||||
except Exception:
|
||||
self.uselib.append(x)
|
||||
else:
|
||||
y.post()
|
||||
|
@ -201,7 +201,7 @@ def use_jar_files(self):
|
|||
for x in names:
|
||||
try:
|
||||
y = get(x)
|
||||
except:
|
||||
except Exception:
|
||||
self.uselib.append(x)
|
||||
else:
|
||||
y.post()
|
||||
|
@ -226,7 +226,7 @@ class jar_create(Task.Task):
|
|||
global JAR_RE
|
||||
try:
|
||||
self.inputs = [x for x in self.basedir.ant_glob(JAR_RE, remove=False) if id(x) != id(self.outputs[0])]
|
||||
except:
|
||||
except Exception:
|
||||
raise Errors.WafError('Could not find the basedir %r for %r' % (self.basedir, self))
|
||||
return super(jar_create, self).runnable_status()
|
||||
|
||||
|
@ -422,7 +422,7 @@ def check_jni_headers(conf):
|
|||
try:
|
||||
conf.check(header_name='jni.h', define_name='HAVE_JNI_H', lib='jvm',
|
||||
libpath=d, includes=incDirs, uselib_store='JAVA', uselib='JAVA')
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
break
|
||||
|
|
|
@ -47,14 +47,6 @@ Setting PYTHONUNBUFFERED gives the unbuffered output.
|
|||
"""
|
||||
|
||||
import os, sys, re, tempfile
|
||||
try:
|
||||
import _winreg
|
||||
except:
|
||||
try:
|
||||
import winreg as _winreg
|
||||
except:
|
||||
_winreg = None
|
||||
|
||||
from waflib import Utils, TaskGen, Runner, Configure, Task, Options
|
||||
from waflib.Logs import debug, info, warn, error
|
||||
from waflib.TaskGen import after_method, before_method, feature
|
||||
|
@ -198,24 +190,24 @@ def gather_wsdk_versions(conf, versions):
|
|||
"""
|
||||
version_pattern = re.compile('^v..?.?\...?.?')
|
||||
try:
|
||||
all_versions = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Microsoft\\Microsoft SDKs\\Windows')
|
||||
all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Microsoft\\Microsoft SDKs\\Windows')
|
||||
except WindowsError:
|
||||
try:
|
||||
all_versions = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows')
|
||||
all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows')
|
||||
except WindowsError:
|
||||
return
|
||||
index = 0
|
||||
while 1:
|
||||
try:
|
||||
version = _winreg.EnumKey(all_versions, index)
|
||||
version = Utils.winreg.EnumKey(all_versions, index)
|
||||
except WindowsError:
|
||||
break
|
||||
index = index + 1
|
||||
if not version_pattern.match(version):
|
||||
continue
|
||||
try:
|
||||
msvc_version = _winreg.OpenKey(all_versions, version)
|
||||
path,type = _winreg.QueryValueEx(msvc_version,'InstallationFolder')
|
||||
msvc_version = Utils.winreg.OpenKey(all_versions, version)
|
||||
path,type = Utils.winreg.QueryValueEx(msvc_version,'InstallationFolder')
|
||||
except WindowsError:
|
||||
continue
|
||||
if os.path.isfile(os.path.join(path, 'bin', 'SetEnv.cmd')):
|
||||
|
@ -236,10 +228,10 @@ def gather_wince_supported_platforms():
|
|||
"""
|
||||
supported_wince_platforms = []
|
||||
try:
|
||||
ce_sdk = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Microsoft\\Windows CE Tools\\SDKs')
|
||||
ce_sdk = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Microsoft\\Windows CE Tools\\SDKs')
|
||||
except WindowsError:
|
||||
try:
|
||||
ce_sdk = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows CE Tools\\SDKs')
|
||||
ce_sdk = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Microsoft\\Windows CE Tools\\SDKs')
|
||||
except WindowsError:
|
||||
ce_sdk = ''
|
||||
if not ce_sdk:
|
||||
|
@ -248,16 +240,16 @@ def gather_wince_supported_platforms():
|
|||
ce_index = 0
|
||||
while 1:
|
||||
try:
|
||||
sdk_device = _winreg.EnumKey(ce_sdk, ce_index)
|
||||
sdk_device = Utils.winreg.EnumKey(ce_sdk, ce_index)
|
||||
except WindowsError:
|
||||
break
|
||||
ce_index = ce_index + 1
|
||||
sdk = _winreg.OpenKey(ce_sdk, sdk_device)
|
||||
sdk = Utils.winreg.OpenKey(ce_sdk, sdk_device)
|
||||
try:
|
||||
path,type = _winreg.QueryValueEx(sdk, 'SDKRootDir')
|
||||
path,type = Utils.winreg.QueryValueEx(sdk, 'SDKRootDir')
|
||||
except WindowsError:
|
||||
try:
|
||||
path,type = _winreg.QueryValueEx(sdk,'SDKInformation')
|
||||
path,type = Utils.winreg.QueryValueEx(sdk,'SDKInformation')
|
||||
path,xml = os.path.split(path)
|
||||
except WindowsError:
|
||||
continue
|
||||
|
@ -280,18 +272,18 @@ def gather_msvc_detected_versions():
|
|||
for vcver,vcvar in [('VCExpress','Exp'), ('VisualStudio','')]:
|
||||
try:
|
||||
prefix = 'SOFTWARE\\Wow6432node\\Microsoft\\'+vcver
|
||||
all_versions = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, prefix)
|
||||
all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, prefix)
|
||||
except WindowsError:
|
||||
try:
|
||||
prefix = 'SOFTWARE\\Microsoft\\'+vcver
|
||||
all_versions = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, prefix)
|
||||
all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, prefix)
|
||||
except WindowsError:
|
||||
continue
|
||||
|
||||
index = 0
|
||||
while 1:
|
||||
try:
|
||||
version = _winreg.EnumKey(all_versions, index)
|
||||
version = Utils.winreg.EnumKey(all_versions, index)
|
||||
except WindowsError:
|
||||
break
|
||||
index = index + 1
|
||||
|
@ -356,10 +348,10 @@ def gather_msvc_versions(conf, versions):
|
|||
for (v,version,reg) in gather_msvc_detected_versions():
|
||||
try:
|
||||
try:
|
||||
msvc_version = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\VC")
|
||||
msvc_version = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\VC")
|
||||
except WindowsError:
|
||||
msvc_version = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\Microsoft Visual C++")
|
||||
path,type = _winreg.QueryValueEx(msvc_version, 'ProductDir')
|
||||
msvc_version = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, reg + "\\Setup\\Microsoft Visual C++")
|
||||
path,type = Utils.winreg.QueryValueEx(msvc_version, 'ProductDir')
|
||||
vc_paths.append((version, os.path.abspath(str(path))))
|
||||
except WindowsError:
|
||||
continue
|
||||
|
@ -386,16 +378,16 @@ def gather_icl_versions(conf, versions):
|
|||
"""
|
||||
version_pattern = re.compile('^...?.?\....?.?')
|
||||
try:
|
||||
all_versions = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Intel\\Compilers\\C++')
|
||||
all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Wow6432node\\Intel\\Compilers\\C++')
|
||||
except WindowsError:
|
||||
try:
|
||||
all_versions = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Intel\\Compilers\\C++')
|
||||
all_versions = Utils.winreg.OpenKey(Utils.winreg.HKEY_LOCAL_MACHINE, 'SOFTWARE\\Intel\\Compilers\\C++')
|
||||
except WindowsError:
|
||||
return
|
||||
index = 0
|
||||
while 1:
|
||||
try:
|
||||
version = _winreg.EnumKey(all_versions, index)
|
||||
version = Utils.winreg.EnumKey(all_versions, index)
|
||||
except WindowsError:
|
||||
break
|
||||
index = index + 1
|
||||
|
@ -406,9 +398,9 @@ def gather_icl_versions(conf, versions):
|
|||
try:
|
||||
if target=='intel64': targetDir='EM64T_NATIVE'
|
||||
else: targetDir=target
|
||||
_winreg.OpenKey(all_versions,version+'\\'+targetDir)
|
||||
icl_version=_winreg.OpenKey(all_versions,version)
|
||||
path,type=_winreg.QueryValueEx(icl_version,'ProductDir')
|
||||
Utils.winreg.OpenKey(all_versions,version+'\\'+targetDir)
|
||||
icl_version=Utils.winreg.OpenKey(all_versions,version)
|
||||
path,type=Utils.winreg.QueryValueEx(icl_version,'ProductDir')
|
||||
if os.path.isfile(os.path.join(path,'bin','iclvars.bat')):
|
||||
try:
|
||||
targets.append((target,(arch,conf.get_msvc_version('intel',version,target,os.path.join(path,'bin','iclvars.bat')))))
|
||||
|
@ -418,8 +410,8 @@ def gather_icl_versions(conf, versions):
|
|||
pass
|
||||
for target,arch in all_icl_platforms:
|
||||
try:
|
||||
icl_version = _winreg.OpenKey(all_versions, version+'\\'+target)
|
||||
path,type = _winreg.QueryValueEx(icl_version,'ProductDir')
|
||||
icl_version = Utils.winreg.OpenKey(all_versions, version+'\\'+target)
|
||||
path,type = Utils.winreg.QueryValueEx(icl_version,'ProductDir')
|
||||
if os.path.isfile(os.path.join(path, 'bin', 'iclvars.bat')):
|
||||
try:
|
||||
targets.append((target, (arch, conf.get_msvc_version('intel', version, target, os.path.join(path, 'bin', 'iclvars.bat')))))
|
||||
|
@ -605,7 +597,7 @@ def autodetect(conf):
|
|||
v['MSVC_COMPILER'] = compiler
|
||||
try:
|
||||
v['MSVC_VERSION'] = float(version)
|
||||
except:
|
||||
except Exception:
|
||||
v['MSVC_VERSION'] = float(version[:-3])
|
||||
|
||||
def _get_prog_names(conf, compiler):
|
||||
|
@ -683,9 +675,9 @@ def visual_studio_add_flags(self):
|
|||
"""visual studio flags found in the system environment"""
|
||||
v = self.env
|
||||
try: v.prepend_value('INCLUDES', self.environ['INCLUDE'].split(';')) # notice the 'S'
|
||||
except: pass
|
||||
except Exception: pass
|
||||
try: v.prepend_value('LIBPATH', self.environ['LIB'].split(';'))
|
||||
except: pass
|
||||
except Exception: pass
|
||||
|
||||
@conf
|
||||
def msvc_common_flags(conf):
|
||||
|
@ -884,7 +876,7 @@ def exec_response_command(self, cmd, **kw):
|
|||
if tmp:
|
||||
try:
|
||||
os.remove(tmp)
|
||||
except:
|
||||
except OSError:
|
||||
pass # anti-virus and indexers can keep the files open -_-
|
||||
return ret
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ def check_perl_module(self, module):
|
|||
self.start_msg('perl module %s' % module)
|
||||
try:
|
||||
r = self.cmd_and_log(cmd)
|
||||
except:
|
||||
except Exception:
|
||||
self.end_msg(False)
|
||||
return None
|
||||
self.end_msg(r or True)
|
||||
|
|
|
@ -63,7 +63,7 @@ def process_py(self, node):
|
|||
try:
|
||||
if not self.bld.is_install:
|
||||
return
|
||||
except:
|
||||
except AttributeError:
|
||||
return
|
||||
|
||||
try:
|
||||
|
@ -104,7 +104,7 @@ def install_pyfile(self, node, install_from=None):
|
|||
if self.bld.is_install > 0:
|
||||
try:
|
||||
st1 = os.stat(path)
|
||||
except:
|
||||
except OSError:
|
||||
error('The python file is missing, this should not happen')
|
||||
|
||||
for x in ['c', 'o']:
|
||||
|
|
|
@ -65,13 +65,13 @@ def check_ruby_version(self, minver=()):
|
|||
|
||||
try:
|
||||
version = self.cmd_and_log([ruby, '-e', 'puts defined?(VERSION) ? VERSION : RUBY_VERSION']).strip()
|
||||
except:
|
||||
except Exception:
|
||||
self.fatal('could not determine ruby version')
|
||||
self.env.RUBY_VERSION = version
|
||||
|
||||
try:
|
||||
ver = tuple(map(int, version.split(".")))
|
||||
except:
|
||||
except Exception:
|
||||
self.fatal('unsupported ruby version %r' % version)
|
||||
|
||||
cver = ''
|
||||
|
@ -158,7 +158,7 @@ def check_ruby_module(self, module_name):
|
|||
self.start_msg('Ruby module %s' % module_name)
|
||||
try:
|
||||
self.cmd_and_log([self.env['RUBY'], '-e', 'require \'%s\';puts 1' % module_name])
|
||||
except:
|
||||
except Exception:
|
||||
self.end_msg(False)
|
||||
self.fatal('Could not find the ruby module %r' % module_name)
|
||||
self.end_msg(True)
|
||||
|
|
|
@ -23,7 +23,7 @@ def find_scc(conf):
|
|||
|
||||
try:
|
||||
conf.cmd_and_log(cc + ['-flags'])
|
||||
except:
|
||||
except Exception:
|
||||
conf.fatal('%r is not a Sun compiler' % cc)
|
||||
|
||||
v['CC'] = cc
|
||||
|
|
|
@ -24,7 +24,7 @@ def find_sxx(conf):
|
|||
|
||||
try:
|
||||
conf.cmd_and_log(cc + ['-flags'])
|
||||
except:
|
||||
except Exception:
|
||||
conf.fatal('%r is not a Sun compiler' % cc)
|
||||
|
||||
v['CXX'] = cc
|
||||
|
|
Loading…
Reference in New Issue