Skip to content
Snippets Groups Projects
Commit c6471922 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

ENH: stop if old config files are used

parent 4a80c79e
No related branches found
No related tags found
1 merge request!111MAINT: LinkAhead rename
Pipeline #40556 failed
......@@ -23,8 +23,10 @@
#
import os
import yaml
import warnings
import yaml
try:
optional_jsonschema_validate = None
from jsonschema import validate as optional_jsonschema_validate
......@@ -32,9 +34,8 @@ except ImportError:
pass
from configparser import ConfigParser
from os import environ, getcwd
from os.path import expanduser, join, isfile
from os.path import expanduser, isfile, join
def _reset_config():
......@@ -108,6 +109,20 @@ def _read_config_files():
"""
return_var = []
if "PYCAOSDBINI" in environ:
raise RuntimeError("You have set the old PYCAOSDBINI environment variable. Please use the "
"new PYLINKAHEADINI variable instead and unset the old one.")
if os.path.exists(expanduser('~/.pycaosdb.ini')):
raise RuntimeError("You have a config file with the old naming scheme (pycaosdb.ini). "
f"Please use the new version and rename\n"
f"{expanduser('~/.pycaosdb.ini')}\n"
f"to\n{expanduser('~/.pylinkahead.ini')}")
if os.path.exists(join(getcwd(), "pycaosdb.ini")):
raise RuntimeError("You have a config file with the old naming scheme (pycaosdb.ini). "
f"Please use the new version and rename\n"
f"{join(getcwd(), 'pycaosdb.ini')}\n"
f"to\n{join(getcwd(), 'pylinkahead.ini')}")
if "PYLINKAHEADINI" in environ:
return_var.extend(configure(expanduser(environ["PYLINKAHEADINI"])))
else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment