From 9ed8d87755eb49aaa89d4d61c643489222c2b69a Mon Sep 17 00:00:00 2001 From: Paul Saxe Date: Mon, 22 Apr 2024 13:44:37 -0400 Subject: [PATCH 1/3] Moved ~/.seammrc to ~/.seamm.d/seammrc --- seamm_util/zenodo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/seamm_util/zenodo.py b/seamm_util/zenodo.py index 40b8ffc..bd3daa4 100644 --- a/seamm_util/zenodo.py +++ b/seamm_util/zenodo.py @@ -463,7 +463,7 @@ def update_metadata(self): class Zenodo(object): - def __init__(self, token=None, configfile="~/.seammrc", use_sandbox=False): + def __init__(self, token=None, configfile="~/.seamm.d/seammrc", use_sandbox=False): if use_sandbox: self.base_url = "https://sandbox.zenodo.org/api" else: From 4440e4631ea733fd9b2f95fa62a8ae9bd83737f5 Mon Sep 17 00:00:00 2001 From: Paul Saxe Date: Mon, 22 Apr 2024 13:45:21 -0400 Subject: [PATCH 2/3] Moved ~/.seammrc to ~/.seamm.d/seammrc --- HISTORY.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/HISTORY.rst b/HISTORY.rst index 62f2ea3..151ba36 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,9 @@ ======= History ======= +2024.4.22 -- Moving user preferences to ~/.seamm.d + * To better support Docker, moving ~/.seammrc to ~/.seamm.d/seamrc + 2023.11.12 -- Internal update * Versioneer needed to be updated to account for changes in configparser. From e3d28026fbb68d8e8de2cb4d314c58fd6becdb7b Mon Sep 17 00:00:00 2001 From: Paul Saxe Date: Mon, 22 Apr 2024 15:24:26 -0400 Subject: [PATCH 3/3] Moved seamm.ini from ~/SEAMM to ~/.seamm.d --- HISTORY.rst | 1 + seamm_util/argument_parser.py | 27 +++++++++++++++++++++++++-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 151ba36..75d9a78 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -3,6 +3,7 @@ History ======= 2024.4.22 -- Moving user preferences to ~/.seamm.d * To better support Docker, moving ~/.seammrc to ~/.seamm.d/seamrc + * Moved seamm.ini from ~/SEAMM to ~/seamm.d since it only contains personal preferences. 2023.11.12 -- Internal update * Versioneer needed to be updated to account for changes in configparser. diff --git a/seamm_util/argument_parser.py b/seamm_util/argument_parser.py index bc95e40..eb75e3d 100644 --- a/seamm_util/argument_parser.py +++ b/seamm_util/argument_parser.py @@ -13,6 +13,7 @@ import configparser import logging import os +from pathlib import Path import sys # logging.basicConfig(level="WARNING") @@ -40,8 +41,7 @@ def __init__( self, *args, ini_files=[ - "etc/SEAMM/seamm.ini", - os.path.expanduser("~/SEAMM/seamm.ini"), + os.path.expanduser("~/.seamm.d/seamm.ini"), "seamm.ini", ], interpolation=configparser.ExtendedInterpolation(), @@ -169,6 +169,29 @@ def parse_args(self, args=None): # 2. Read the .ini files, if any. + # Moving from ~/SEAMM/seamm.ini to ~/.seamm.d/seamm.ini + # Make directory and move if it does not exist + path = Path("~/.seamm.d/seamm.ini").expanduser() + tmp = Path("~/SEAMM/seamm.ini").expanduser() + print(f"{path=}") + print(f"{path.exists()=}") + print(f" {tmp=}") + print(f"{tmp.exists()=}") + if not path.parent.exists(): + path.parent.mkdir(parents=True) + print("made directory") + else: + print("directory existed") + + if tmp.exists() and not path.exists(): + print("/ntext:") + print(tmp.read_text()) + print() + path.write_text(tmp.read_text()) + tmp.unlink() + + # Now read... + config = configparser.ConfigParser(interpolation=None) self._ini_files_used = config.read(self._ini_files)