X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2F__init__.py;h=7a4ac04af6224aa37a7cfb13a3d6c320e771ba2d;hb=78cadadada66b6e6c2e5a5c2dc9f307fff33f2ab;hp=de1969cc4663261223d0a4be298b0eabfdd841b9;hpb=cfa9edfb956345c69090469b519a94dcc55ba382;p=tools%2Fsat.git diff --git a/src/__init__.py b/src/__init__.py index de1969c..7a4ac04 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -32,10 +32,15 @@ from . import product 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 @@ -121,6 +126,26 @@ def get_base_path(config): 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') @@ -289,4 +314,31 @@ def deepcopy_list(input_list): 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