blob: 99a5cea2d54d0ab5179dff3d37fbbff19dc3bfb8 [file] [log] [blame] [edit]
############################################################################
# Copyright (C) SchedMD LLC.
############################################################################
import re
from collections import OrderedDict
def get_vars_from_conf(filename, comment="#"):
data = OrderedDict()
with open(filename) as f:
for line in f:
if not line.startswith(comment):
if re.search(r"\s*\S+\s*=\s*\S+\s*$", line):
name, val = line.strip().replace(" ", "").split("=")
data[name] = val
return data