from . import environment
from . import fileEnviron
from . import compilation
+from . import test_module
OK_STATUS = "OK"
KO_STATUS = "KO"
NA_STATUS = "NA"
+KNOWNFAILURE_STATUS = "KF"
+TIMEOUT_STATUS = "TIMEOUT"
+
+CONFIG_FILENAME = "sat-config.pyconf"
class SatException(Exception):
'''rename Exception Class
base_path = config.USER.base
return base_path
+def get_salome_version(config):
+ if hasattr(config.APPLICATION, 'version_salome'):
+ Version = config.APPLICATION.version_salome
+ else:
+ KERNEL_info = product.get_product_config(config, "KERNEL")
+ VERSION = os.path.join(
+ KERNEL_info.install_dir,
+ "bin",
+ "salome",
+ "VERSION")
+ if not os.path.isfile(VERSION):
+ return None
+
+ fVERSION = open(VERSION)
+ Version = fVERSION.readline()
+ fVERSION.close()
+
+ VersionSalome = int(only_numbers(Version))
+ return VersionSalome
+
def only_numbers(str_num):
return ''.join([nb for nb in str_num if nb in '0123456789'] or '0')
res = []
for elem in input_list:
res.append(elem)
- return res
\ No newline at end of file
+ return res
+
+def parse_date(date):
+ """Transform YYYYMMDD_hhmmss into YYYY-MM-DD hh:mm:ss.
+
+ :param date str: The date to transform
+ :return: The date in the new format
+ :rtype: str
+ """
+ if len(date) != 15:
+ return date
+ res = "%s-%s-%s %s:%s:%s" % (date[0:4],
+ date[4:6],
+ date[6:8],
+ date[9:11],
+ date[11:13],
+ date[13:])
+ return res
+
+def merge_dicts(*dict_args):
+ '''
+ Given any number of dicts, shallow copy and merge into a new dict,
+ precedence goes to key value pairs in latter dicts.
+ '''
+ result = {}
+ for dictionary in dict_args:
+ result.update(dictionary)
+ return result