diff --git a/HISTORY.rst b/HISTORY.rst index 38e62be..642c5db 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,10 @@ ======= History ======= +2023.12.12 -- Moving ~/.seammrc to ~/.seamm.d/seammrc + * Should have no effect on users. The seammrc file will be moved automatically to + its new location. This change is necessary to be able to run SEAMM in containers. + 2023.11.15 -- Add boolean options when submitting jobs * Added boolean control parameters when submitting jobs. * Bugfix: The previous change to allow running "flowchart.flow" in the current diff --git a/seamm/seammrc.py b/seamm/seammrc.py index 772906c..63d09fb 100644 --- a/seamm/seammrc.py +++ b/seamm/seammrc.py @@ -23,7 +23,7 @@ def __new__(class_, *args, **kwargs): class SEAMMrc(Singleton): - def __init__(self, path="~/.seammrc"): + def __init__(self, path="~/.seamm.d/seammrc"): self._config = configparser.ConfigParser() self.path = Path(path).expanduser() @@ -31,8 +31,18 @@ def __init__(self, path="~/.seammrc"): if self.path.exists(): self._config.read(self.path) else: - self.path.parent.mkdir(parents=True, exist_ok=True) - self._save() + # Initially used ~/.seammrc but this doesn't play well with Docker + # containers, so moved to ~/seamm.d/seammrc Check for the old file and move + # to new + tmp = Path("~/.seammrc").expanduser() + if tmp.exists(): + self.path.parent.mkdir(parents=True, exist_ok=True) + self.path.write_text(tmp.read_text()) + self._config.read(self.path) + tmp.unlink() + else: + self.path.parent.mkdir(parents=True, exist_ok=True) + self._save() # Check the version and upgrade if necessary if "VERSION" not in self._config: