try:
import unittestpy.HTMLTestRunner as HTST
-except:
+except Exception:
HTST = None
errPrint("""
WARNING: no HTML output available.
try:
import xmlrunner as XTST
-except:
+except Exception:
XTST = None
errPrint("""
WARNING: no XML output available for unittest.
if text is not None:
try:
n.text = text.strip("\n\t").decode("UTF-8")
- except:
+ except Exception:
sys.stderr.write("################ %s %s\n" % (node_name, text))
n.text = "?"
parent.append(n)
batch=True,
verbose=0,
logger_add_link = logger)
- except:
+ except Exception:
pass
if check_salome_configuration:
env=build_environ.environ.environ,
stderr=subprocess.STDOUT).decode(sys.stdout.encoding).strip()
pip_build_options=int(res_pip_version.split('.')[0]) < 21
- except:
+ except Exception:
pip_build_options= True
# d- install (in python or in separate product directory)
if src.appli_test_property(config,"pip_install_dir", "python"):
if dir(a).__contains__('keys'):
vals = map(lambda x: head + '.' + x,
[m for m in a.keys() if m.startswith(tail)])
- except:
+ except Exception:
pass
for v in sorted(vals):
# get files to build a template GUI
try: # try new yacsgen api
gui_files = salome_compo.getGUIfilesTemplate(compo)
- except: # use old yacsgen api
+ except Exception: # use old yacsgen api
gui_files = salome_compo.getGUIfilesTemplate()
else:
gui_files = None
# generate problem
try:
import paramiko
-except:
+except Exception:
paramiko = "import paramiko impossible"
pass
except paramiko.SSHException:
message = ( _("SSHException error connecting or "
"establishing an SSH session"))
- except:
+ except Exception:
message = ( _("Error connecting or establishing an SSH session"))
else:
self._connection_successful = True
": the server failed to execute the command\n")
logger.write( src.printcolors.printcError(message))
return (None, None, None)
- except:
+ except Exception:
logger.write( src.printcolors.printcError(src.KO_STATUS + '\n'))
return (None, None, None)
else:
'''
try:
pids = self.get_pids()
- except:
+ except Exception:
return ("Unable to get the pid of the command.", "")
cmd_kill = " ; ".join([("kill -2 " + pid) for pid in pids])
x = int(rep)
if x > nb:
x = -1
- except:
+ except Exception:
x = -1
return x
src.ensure_path_exists(os.path.join(logDir, "TEST"))
shutil.copy(xsltest, os.path.join(logDir, "TEST"))
shutil.copy(imgLogo, logDir)
- except:
+ except Exception:
# we are here if an user make sat log in jenkins LOGS without write rights
# Make a warning and do nothing
logger.warning("problem for writing in directory '%s', may be not owner." % logDir)
notShownCommands = notShownCommands)
logger.write(src.printcolors.printc("OK"), 3)
- except:
+ except Exception:
logger.write(src.printcolors.printc("KO"), 3)
logger.write(" problem update hat.xml", 3)
import imp
distene = imp.load_source('distene_licence', distene_licence_file)
distene.set_distene_variables(context)
- except:
+ except Exception:
pass\n""" % licence_file
text.insert(num_line + 1, text_to_insert)
for line in text:
if not src.architecture.is_windows():
try:
t = os.getcwd()
- except:
+ except Exception:
# In the jobs, os.getcwd() can fail
t = config.LOCAL.workdir
os.chdir(tmp_working_dir)
try:
project_pyconf_cfg = config.PROJECTS.projects.__getattr__(name_project)
- except:
+ except Exception:
logger.write("""
WARNING: inexisting config.PROJECTS.projects.%s, try to read now from:\n%s\n""" % (name_project, project_file_path))
project_pyconf_cfg = src.pyconf.Config(project_file_path)
# case if no application, only package sat as 'sat package -t'
try:
app = runner.cfg.APPLICATION
- except:
+ except Exception:
app = None
# unconditionaly remove the tmp_local_working_dir
# Python 2/3 compatibility for execfile function
try:
execfile
-except:
+except Exception:
def execfile(somefile, global_vars, local_vars):
with open(somefile) as f:
code = compile(f.read(), somefile, 'exec')
#shutil.rmtree(finalPath)
os.makedirs(finalPath)
pathIsOk = True
- except:
+ except Exception:
logger.error(_("%s cannot be created.") % finalPath)
finalPath = ask_a_path()
if os.access(tmp_dir, os.F_OK):
try:
shutil.rmtree(tmp_dir)
- except:
+ except Exception:
logger.error(_("error removing TT_TMP_RESULT %s\n")
% tmp_dir)
try:
__LANG__ = os.environ["LANG"] # original locale
-except:
+except Exception:
__LANG__ = "en_US.utf8" #default
__FR__={
if "FR" in __LANG__:
try:
return __FR__[text]
- except:
+ except Exception:
return text
return text
if __verbose__ is None:
try:
__verbose__ = int( os.getenv( 'SALOME_VERBOSE', 0 ) )
- except:
+ except Exception:
__verbose__ = 0
pass
pass
try:
builder.DefineComponentInstance( father, getEngine() )
pass
- except:
+ except Exception:
pass
pass
return father
if __verbose__ is None:
try:
__verbose__ = int( os.getenv( 'SALOME_VERBOSE', 0 ) )
- except:
+ except Exception:
__verbose__ = 0
pass
pass
try:
builder.DefineComponentInstance( father, getEngine() )
pass
- except:
+ except Exception:
pass
pass
return father
"""
try:
aStr = etree.tostring(node, encoding='unicode', method="pretty_xml")
- except:
+ except Exception:
print("*****************************\n problem node", node)
# try no pretty
aStr = etree.tostring(node, encoding='unicode')
if items or xmlns_items:
try:
items = sorted(items) # lexical order
- except:
+ except Exception:
print("*** problem sorting items", items)
for k, v in items:
try:
for item in self._data:
try:
text += item
- except:
+ except Exception:
text += item.decode()
if self._tail:
assert self._last.tail is None, "internal error (tail)"
"""
try:
self._parser.Parse(data, 0)
- except:
+ except Exception:
print("*** problem feed:\n%s" % data.decode('utf-8'))
##
close_source = True
try:
return _IterParseIterator(source, events, parser, close_source)
- except:
+ except Exception:
if close_source:
source.close()
raise
else:
self._root = self._parser._close_and_return_root()
self.root = self._root
- except:
+ except Exception:
if self._close_file:
self._file.close()
raise
try:
os.symlink(str(path), self.path)
return True
- except:
+ except Exception:
return False
def copylink(self, path):
try:
os.symlink(os.readlink(self.path), str(path))
return True
- except:
+ except Exception:
return False
def copydir(self, dst, smart=False):
dstname = dst + name
srcname.copy(dstname, smart)
return True
- except:
+ except Exception:
return False
def copyfile(self, path):
try:
shutil.copy2(self.path, str(path))
return True
- except:
+ except Exception:
return False
def find_file_in_lpath(file_name, lpath, additional_dir = ""):
ftp.cwd(directory)
if additional_dir:
ftp.cwd(additional_dir)
- except:
+ except Exception:
logger.error("while connecting to ftp server %s\n" % ftp_server)
continue
if ftp.size(file_name_md5) > 0:
with open(destination_md5,'wb') as dest_file_md5:
ftp.retrbinary("RETR "+file_name_md5, dest_file_md5.write)
- except:
+ except Exception:
pass
try:
ftp.retrbinary("RETR "+file_name, dest_file.write)
logger.write(" Archive %s was retrieved and stored in %s\n" % (file_name, destination), 3)
return destination
- except:
+ except Exception:
logger.error("File not found in ftp_archive %s\n" % ftp_server)
return False
# write an error message if distro is not installed
try:
from platform import linux_distribution
-except:
+except Exception:
try:
from distro import linux_distribution
- except:
+ except Exception:
print ("\nError :\n"
" linux_distribution was removed from platform module in Python 3.8+\n"
" For python 3.8+ sat requires distro module to get information on linux distribution.\n"
if namesrc == "__main__":
namesrc = os.path.basename(fr.f_globals["__file__"])
lineno.insert(0, (namesrc + "[%s]" % fr.f_lineno))
- except:
+ except Exception:
lineno.insert(0, ("??", fr.f_lineno))
if codename != '<module>': # top level usually
pymodule = imp.load_source(product + "_compile_script", script)
self.nb_proc = nb_proc
retcode = pymodule.compil(self.config, self, self.logger)
- except:
+ except Exception:
__, exceptionValue, exceptionTraceback = sys.exc_info()
self.logger.write(str(exceptionValue), 1)
import traceback
# Compatibility python 2/3 for unicode
try:
_test = unicode
-except:
+except Exception:
unicode = str
# Compatibility python 2/3 for StringIO
try: #type config, mapping
order = object.__getattribute__(config, 'order')
data = object.__getattribute__(config, 'data')
- except:
+ except Exception:
aStream.write("%s%s : '%s'\n" % (indstr, path, str(config)))
return
for key in sorted(data): #order): # data as sort alphabetical, order as initial order
for k in self.environ.environ.keys():
try:
value = self.get(k)
- except:
+ except Exception:
value = "?"
out.write("%s=%s\n" % (k, value))
# not mandatory, if set_nativ_env not defined, we do nothing
if "set_nativ_env" in dir(pyproduct):
pyproduct.set_nativ_env(self)
- except:
+ except Exception:
__, exceptionValue, exceptionTraceback = sys.exc_info()
print(exceptionValue)
import traceback
try:
statinfo = os.stat(os.path.join(tmp_dir, file_name))
currentTime = statinfo.st_mtime
- except:
+ except Exception:
pass
if currentTime and currentTime > beginTime:
self.flush()
except (KeyboardInterrupt, SystemExit):
raise
- except:
+ except Exception:
self.handleError(record)
"prod_name" : prod_info.name})
raise src.SatException(msg)
patches.append(patch_path)
- except:
+ except Exception:
DBG.tofix("problem in prod_info.patches", prod_info)
prod_info.patches = patches
# decode version number
try:
versionMMP = VMMP.MinorMajorPatch(version)
- except: # example setuptools raise "minor in major_minor_patch is not integer: '0_6c11'"
+ except Exception: # example setuptools raise "minor in major_minor_patch is not integer: '0_6c11'"
versionMMP = None
# if a section is explicitely specified we select it
try:
with open(aFile, 'w') as f:
p_info.__save__(f, evaluated=True) # evaluated expressions mode
- except:
+ except Exception:
# sometime some information cannot be evaluated.
# for example, in the context of non VCS archives, information on git server is not available.
DBG.write("Warning : sat was not able to evaluate and write down some information in file %s" % aFile)
else:
res.append((p_name, p_info))
ok.append(p_name)
- except:
+ except Exception:
res.append((p_name, p_info))
ok.append(p_name)
else:
ok.append(p_name)
else:
ko.append(p_name)
- except:
+ except Exception:
ko.append(p_name)
if len(ok) != len(resAll):
try:
has_utf32 = True
-except:
+except Exception:
has_utf32 = False
class ConfigInputStream(object):
rv = eval(str(self)[1:-1], vars(ns))
found = True
break
- except:
+ except Exception:
pass
if found:
break
key = item[1]
rv = rv[key]
break
- except:
+ except Exception:
rv = None
pass
current = object.__getattribute__(current, 'parent')
continue
try:
exec( 'map1.' + key + " = " + repr(overwrite_instruction[key]))
- except:
+ except Exception:
exec('map1.' + key + " = " + str(overwrite_instruction[key]))
else:
for key in overwrite_instruction.keys():
try:
exec('map1.' + key + " = " + repr(overwrite_instruction[key]))
- except:
+ except Exception:
exec('map1.' + key + " = " + str(overwrite_instruction[key]))
def mergeMapping(self, map1, map2):
"""return system return code as bash or bat"""
try:
return self._TOSYS[self._status]
- except:
+ except Exception:
return self._TOSYS[self.NA_STATUS]
def toXmlPassed(self):
try:
_LANG = os.environ["LANG"] # original locale
-except:
+except Exception:
_LANG = "en_US.utf8" #default
# The possible hooks :
sys.stderr = ff
import paramiko
sys.stderr = saveout
- except:
+ except Exception:
sys.stderr = saveout
continue
logger.write('Launched command:\n' + cmd + '\n', 5)
p = SP.Popen(cmd, shell=True)
p.communicate()
- except:
+ except Exception:
logger.write(printcolors.printcError(_("Unable to edit file %s\n")
% filePath), 1)
try:
output = SP.check_output(['grep', pkg], stdin=p.stdout)
msg_status=src.printcolors.printcSuccess("OK")
- except:
+ except Exception:
msg_status=src.printcolors.printcError("KO")
msg_status+=" (package is not installed!)\n"
elif check_cmd[0] == "dpkg-query":
try:
line.index('Universal name of mesh')
continue
- except:
+ except Exception:
dumpfile.write(line.replace(med, 'filename'))
return dump
# Python 2/3 compatibility for execfile function
try:
execfile
-except:
+except Exception:
def execfile(somefile, global_vars, local_vars):
with open(somefile) as f:
code = compile(f.read(), somefile, 'exec')
if 'time' in ldic:
try:
exec_time = float(ldic['time'])
- except:
+ except Exception:
pass
results[test] = [status, exec_time, callback, expected]
- except:
+ except Exception:
results[test] = ["?", -1, "", []]
# results[test] = [src.O_STATUS, -1, open(resfile, 'r').read(), []]
try:
grid = imp.load_module(sal_uts, file_, pathname, description)
return grid.getLogDir
- except:
+ except Exception:
grid = imp.load_module(sal_uts, file_, pathname, description)
return grid.getTmpDir
finally:
try:
ii = int(res[0])
- except:
+ except Exception:
msg = "major in major_minor_patch is not integer: '%s'" % aStr
raise Exception(msg)
if ii < 0:
try:
ii = int(res[1])
- except:
+ except Exception:
msg = "minor in major_minor_patch is not integer: '%s'" % aStr
raise Exception(msg)
if ii < 0:
try:
ii = int(res[2])
- except:
+ except Exception:
msg = "patch in major_minor_patch is not integer: '%s'" % aStr
raise Exception(msg)
if ii < 0:
try:
rMin = MinorMajorPatch(aMin)
rMax = MinorMajorPatch(aMax)
- except:
+ except Exception:
msg = "problem version range in '%s'" % aStr
raise Exception(msg)
"""if verbose:
import sys
reload(sys)
sys.setdefaultencoding('utf8')
-except:
+except Exception:
pass
import src
try:
import paramiko as PK
- except:
+ except Exception:
print("\nproblem 'import paramiko', no tests")
return
sat.log('-t')
OK = "OK"
sys.stdin = sys.__stdin__
- except:
+ except Exception:
sys.stdin = sys.__stdin__
self.assertEqual(OK, "OK")
sat.log('appli-test -t --last')
OK = "OK"
sys.stdin = sys.__stdin__
- except:
+ except Exception:
pass
self.assertEqual(OK, "OK")
try:
sat.prepare(appli + " --force --force_patch")
OK = 'OK'
- except:
+ except Exception:
pass
self.assertEqual(OK, 'OK')