diff options
Diffstat (limited to 'scripts/utils.py')
-rw-r--r-- | scripts/utils.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/scripts/utils.py b/scripts/utils.py index 0b6ac9c..060aa3e 100644 --- a/scripts/utils.py +++ b/scripts/utils.py @@ -114,3 +114,32 @@ def config_strtoint(str): except ValueError: pass return rtn + +def get_config_from_hash(hash): + with open(sf(conf.config_map_file), "r") as f: + for line in f: + w = line.rstrip().split(sep=':') + if w[0] == hash: + return config_strtoint(w[1]) + return None + +def get_last_configuration(): + hsh = "" + try: + with open(sf(conf.config_solved_file), "r") as f: + for line in f: + sline = line.rstrip() + if sline != '': + hsh = sline + except FileNotFoundError: + try: + with open(sf(conf.config_map_file), "r") as f: + w = f.readline().split(sep=':') + hsh = w[0] + except FileNotFoundError: + pass + + if hsh != '': + return hsh + else: + return 'NoConfig' |