コード例 #1
0
ファイル: config.py プロジェクト: davidziman/Bicho
    def load():
        """
        Try to load a config file from known default locations.

        For the format of the config file, see 'config.sample'
        in the toplevel directory.
        """
        # FIXME: a hack to avoid circular dependencies.
        from utils import bicho_dot_dir, printout

        # First look in /etc
        # FIXME /etc is not portable
        config_file = os.path.join('/etc', 'bicho')
        if os.path.isfile(config_file):
            Config.load_from_file(config_file)

        # Then look at $HOME
        config_file = os.path.join(bicho_dot_dir(), 'config')
        if os.path.isfile(config_file):
            Config.load_from_file(config_file)
        else:
            # If there's an old file, migrate it
            old_config = os.path.join(os.environ.get('HOME'), '.bicho')
            if os.path.isfile(old_config):
                printout("Old config file found in %s, moving to %s",
                         (old_config, config_file))
                os.rename(old_config, config_file)
                Config.load_from_file(config_file)
コード例 #2
0
    def load():
        """
        Try to load a config file from known default locations.

        For the format of the config file, see 'config.sample'
        in the toplevel directory.
        """
        # FIXME: a hack to avoid circular dependencies.
        from utils import bicho_dot_dir, printout

        # First look in /etc
        # FIXME /etc is not portable
        config_file = os.path.join('/etc', 'bicho')
        if os.path.isfile(config_file):
            Config.load_from_file(config_file)

        # Then look at $HOME
        config_file = os.path.join(bicho_dot_dir(), 'config')
        if os.path.isfile(config_file):
            Config.load_from_file(config_file)
        else:
            # If there's an old file, migrate it
            old_config = os.path.join(os.environ.get('HOME'), '.bicho')
            if os.path.isfile(old_config):
                printout("Old config file found in %s, moving to %s",
                         (old_config, config_file))
                os.rename(old_config, config_file)
                Config.load_from_file(config_file)
コード例 #3
0
ファイル: Config.py プロジェクト: f-breidenstein/Bicho
    def load ():
        # FIXME: a hack to avoid circular dependencies. 
        from utils import bicho_dot_dir, printout

        # First look in /etc
        # FIXME /etc is not portable
        config_file = os.path.join ('/etc', 'bicho')
        if os.path.isfile (config_file):
            Config.load_from_file (config_file)

        # Then look at $HOME
        config_file = os.path.join (bicho_dot_dir (), 'config')
        if os.path.isfile (config_file):
            Config.load_from_file (config_file) 
        else:
            # If there's an old file, migrate it
            old_config = os.path.join (os.environ.get ('HOME'), '.bicho')
            if os.path.isfile (old_config):
                printout ("Old config file found in %s, moving to %s", \
                              (old_config, config_file))
                os.rename (old_config, config_file)
                Config.load_from_file (config_file)
コード例 #4
0
ファイル: Config.py プロジェクト: libresoft/Bicho
    def load (self):
        import os
        from utils import bicho_dot_dir, printout

        # First look in /etc
        # FIXME /etc is not portable
        config_file = os.path.join ('/etc', 'bicho')
        if os.path.isfile (config_file):
            self.__load_from_file (config_file)

        # Then look at $HOME
        config_file = os.path.join (bicho_dot_dir (), 'config')
        if os.path.isfile (config_file):
            self.__load_from_file (config_file)
        else:
            # If there's an old file, migrate it
            old_config = os.path.join (os.environ.get ('HOME'), '.bicho')
            if os.path.isfile (old_config):
                printout ("Old config file found in %s, moving to %s", \
                              (old_config, config_file))
                os.rename (old_config, config_file)
                self.__load_from_file (config_file)
コード例 #5
0
ファイル: Config.py プロジェクト: iKuba/Bicho
    def load():
        # FIXME: a hack to avoid circular dependencies.
        from utils import bicho_dot_dir, printout

        # First look in /etc
        # FIXME /etc is not portable
        config_file = os.path.join('/etc', 'bicho')
        if os.path.isfile(config_file):
            Config.load_from_file(config_file)

        # Then look at $HOME
        config_file = os.path.join(bicho_dot_dir(), 'config')
        if os.path.isfile(config_file):
            Config.load_from_file(config_file)
        else:
            # If there's an old file, migrate it
            old_config = os.path.join(os.environ.get('HOME'), '.bicho')
            if os.path.isfile(old_config):
                printout ("Old config file found in %s, moving to %s", \
                              (old_config, config_file))
                os.rename(old_config, config_file)
                Config.load_from_file(config_file)