Skip to content

Commit

Permalink
Moving ~/.seammrc to ~/.seamm.d/seammrc to allow running in containers.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulsaxe committed Dec 12, 2023
1 parent 754bfd7 commit 0410a07
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
4 changes: 4 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 13 additions & 3 deletions seamm/seammrc.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,26 @@ 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()

# Create the file if it doesn't exist
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:
Expand Down

0 comments on commit 0410a07

Please sign in to comment.