コード例 #1
0
ファイル: config.py プロジェクト: ShenggaoZhu/spyder
    def __init__(self, name, root_path, filename, defaults=None, load=True,
                 version=None):
        self.project_root_path = root_path

        # Config rootpath
        self._root_path = os.path.join(root_path, PROJECT_FOLDER)
        self._filename = filename

        # Create folder if non existent
        if not os.path.isdir(self._root_path):
            os.makedirs(self._root_path)

        # Add file
        # NOTE: We have to think better about the uses of this file
        # with open(os.path.join(root_path, PROJECT_FILENAME), 'w') as f:
        #    f.write('spyder-ide project\n')

        UserConfig.__init__(self, name, defaults=defaults, load=load,
                            version=version, subfolder=None, backup=False,
                            raw_mode=True, remove_obsolete=True)
コード例 #2
0
# =============================================================================
# IMPORTANT NOTES:
# 1. If you want to *change* the default value of a current option, you need to
#    do a MINOR update in config version, e.g. from 3.0.0 to 3.1.0
# 2. If you want to *remove* options that are no longer needed in our codebase,
#    or if you want to *rename* options, then you need to do a MAJOR update in
#    version, e.g. from 3.0.0 to 4.0.0
# 3. You don't need to touch this value if you're just adding a new option
CONF_VERSION = '47.8.0'

# Main configuration instance
try:
    CONF = UserConfig('spyder',
                      defaults=DEFAULTS,
                      load=True,
                      version=CONF_VERSION,
                      subfolder=SUBFOLDER,
                      backup=True,
                      raw_mode=True)
except Exception:
    CONF = UserConfig('spyder',
                      defaults=DEFAULTS,
                      load=False,
                      version=CONF_VERSION,
                      subfolder=SUBFOLDER,
                      backup=True,
                      raw_mode=True)

# Removing old .spyder.ini location:
old_location = osp.join(get_home_dir(), '.spyder.ini')
if osp.isfile(old_location):