from . import fileEnviron
from . import compilation
from . import test_module
+from . import template
OK_STATUS = "OK"
KO_STATUS = "KO"
KNOWNFAILURE_STATUS = "KF"
TIMEOUT_STATUS = "TIMEOUT"
+CONFIG_FILENAME = "sat-config.pyconf"
+
class SatException(Exception):
'''rename Exception Class
'''
:return: The path of the product base.
:rtype: str
'''
- if "base" in config.SITE:
- base_path = config.SITE.base
- else:
- # default base
- base_path = config.USER.base
- return base_path
+ if "base" not in config.SITE:
+ site_file_path = os.path.join(config.VARS.salometoolsway,
+ "data",
+ "site.pyconf")
+ msg = _("Please define a base path in the file %s" % site_file_path)
+ raise SatException(msg)
+
+ return config.SITE.base
def get_salome_version(config):
if hasattr(config.APPLICATION, 'version_salome'):
def isdir(self):
return os.path.isdir(self.path)
+ def isfile(self):
+ return os.path.isfile(self.path)
+
def list(self):
return [Path(p) for p in os.listdir(self.path)]
for dictionary in dict_args:
result.update(dictionary)
return result
+
+def replace_in_file(filein, strin, strout):
+ '''Replace <strin> by <strout> in file <filein>
+ '''
+ shutil.move(filein, filein + "_old")
+ fileout= filein
+ filein = filein + "_old"
+ fin = open(filein, "r")
+ fout = open(fileout, "w")
+ for line in fin:
+ fout.write(line.replace(strin, strout))
\ No newline at end of file