3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 01:09:22 +01:00

conf: add migration warning for the config file rename

This commit is contained in:
James Lu 2016-07-19 17:40:22 -07:00
parent 1629533242
commit 166adcf44d

20
conf.py
View File

@ -61,14 +61,16 @@ def loadConf(filename, errors_fatal=True):
global confname, conf, fname global confname, conf, fname
fname = filename fname = filename
confname = filename.split('.', 1)[0] confname = filename.split('.', 1)[0]
with open(filename, 'r') as f: try:
try: with open(filename, 'r') as f:
conf = yaml.load(f) conf = yaml.load(f)
conf = validateConf(conf) conf = validateConf(conf)
except Exception as e: except Exception as e:
print('ERROR: Failed to load config from %r: %s: %s' % (filename, type(e).__name__, e)) print('ERROR: Failed to load config from %r: %s: %s' % (filename, type(e).__name__, e), file=sys.stderr)
if errors_fatal: print(' Users upgrading from users < 0.9-alpha1 should note that the default configuration has been renamed to *pylink.yml*, not *config.yml*', file=sys.stderr)
sys.exit(4)
raise if errors_fatal:
else: sys.exit(4)
return conf raise
else:
return conf