diff sat/tools/config.py @ 3281:a3639d6d9643

core: replaced `sat` shell script by a python script: the backend is now launched by `sat.core.launcher`, and the script is generated during installation with a new entry point in `setup.py`.
author Goffi <goffi@goffi.org>
date Mon, 25 May 2020 15:50:01 +0200
parents 60a9e47ef988
children be6d91572633
line wrap: on
line diff
--- a/sat/tools/config.py	Mon May 25 15:46:21 2020 +0200
+++ b/sat/tools/config.py	Mon May 25 15:50:01 2020 +0200
@@ -34,8 +34,10 @@
 
 
 def fixConfigOption(section, option, value, silent=True):
-    """Force a configuration option value, writing it in the first found user
-    config file, eventually creating a new user config file if none is found.
+    """Force a configuration option value
+
+    the option will be written in the first found user config file, a new user
+    config will be created if none is found.
 
     @param section (str): the config section
     @param option (str): the config option
@@ -70,35 +72,6 @@
                                                 config_file=target_file))
 
 
-# XXX: tmp update code, will be removed in the future
-# When you remove this, please add the default value for
-# 'local_dir' in sat.core.constants.Const.DEFAULT_CONFIG
-def fixLocalDir(silent=True):
-    """Retro-compatibility with the previous local_dir default value.
-
-    @param silent (boolean): toggle logging output (must be True when called from sat.sh)
-    """
-    user_config = ConfigParser()
-    try:
-        user_config.read(C.CONFIG_FILES)
-    except:
-        pass  # file is readable but its structure if wrong
-    try:
-        current_value = user_config.get("DEFAULT", "local_dir")
-    except (NoOptionError, NoSectionError):
-        current_value = ""
-    if current_value:
-        return  # nothing to do
-    old_default = "~/.sat"
-    if os.path.isfile(os.path.expanduser(old_default) + "/" + C.SAVEFILE_DATABASE):
-        if not silent:
-            log.warning(_(
-                "A database has been found in the default local_dir for previous "
-                "versions (< 0.5)"
-            ))
-        fixConfigOption("", "local_dir", old_default, silent)
-
-
 def parseMainConf(log_filenames=False):
     """Look for main .ini configuration file, and parse it