in mozregression/config.py [0:0]
def write_config(conf_path):
conf_dir = os.path.dirname(conf_path)
if not os.path.isdir(conf_dir):
os.makedirs(conf_dir)
config = ConfigObj(conf_path, encoding="UTF8")
if not config.initial_comment:
config.initial_comment = CONF_HELP.splitlines()
def _set_option(optname, getfunc, default):
print()
if optname not in config:
value = getfunc(default)
if value is not None:
config[optname] = value
else:
value = default
else:
print("%s already defined." % optname)
value = config[optname]
name = colorize("{fGREEN}%s{sRESET_ALL}" % optname)
print("%s: %s" % (name, value))
_set_option("persist", _get_persist_dir, os.path.join(conf_dir, "persist"))
_set_option("persist-size-limit", _get_persist_size_limit, 20.0)
if mozinfo.os != "mac" and mozinfo.bits == 64:
_set_option("bits", _get_bits, 64)
config.write()
print()
print(colorize("Config file {sBRIGHT}%s{sRESET_ALL} written." % conf_path))
print(
"Note you can edit it manually, and there are other options you can"
" configure. See %s." % CONFIG_FILE_HELP_URL
)