예제 #1
0
파일: cli.py 프로젝트: 3nth/dotfiles-python
def main():

    global settings

    (cli_opts, args) = parse_args()

    settings['homedir'] = realpath_expanduser(cli_opts.homedir or 
            defaults['homedir'])
    settings['config_file'] = realpath_expanduser(cli_opts.config_file or
            defaults['config_file'])

    config_opts = parse_config(settings['config_file'])

    settings['repository'] = realpath_expanduser(cli_opts.repository or
            config_opts['repository'] or defaults['repository'])

    check_repository_exists()

    update_settings(config_opts, 'ignore')
    update_settings(config_opts, 'externals')
    update_settings(config_opts, 'packages')

    repo_config_file = os.path.join(settings['repository'], '.dotfilesrc')
    repo_config_opts = parse_config(repo_config_file)

    settings['prefix'] = (cli_opts.prefix or
                          repo_config_opts['prefix'] or
                          config_opts['prefix'] or
                          defaults['prefix'])

    settings['dry_run'] = cli_opts.dry_run

    update_settings(repo_config_opts, 'ignore')
    update_settings(repo_config_opts, 'externals')
    update_settings(repo_config_opts, 'packages')

    dotfiles = core.Dotfiles(**settings)

    dispatch(dotfiles, cli_opts.action, cli_opts.force, args)
예제 #2
0
def main():

    global settings

    (cli_opts, args) = parse_args()

    settings['homedir'] = realpath_expanduser(cli_opts.homedir
                                              or defaults['homedir'])
    settings['config_file'] = realpath_expanduser(cli_opts.config_file
                                                  or defaults['config_file'])

    config_opts = parse_config(settings['config_file'])

    settings['repository'] = realpath_expanduser(cli_opts.repository
                                                 or config_opts['repository']
                                                 or defaults['repository'])

    check_repository_exists()

    update_settings(config_opts, 'ignore')
    update_settings(config_opts, 'externals')
    update_settings(config_opts, 'packages')

    repo_config_file = os.path.join(settings['repository'], '.dotfilesrc')
    repo_config_opts = parse_config(repo_config_file)

    settings['prefix'] = (cli_opts.prefix or repo_config_opts['prefix']
                          or config_opts['prefix'] or defaults['prefix'])

    settings['dry_run'] = cli_opts.dry_run

    update_settings(repo_config_opts, 'ignore')
    update_settings(repo_config_opts, 'externals')
    update_settings(repo_config_opts, 'packages')

    dotfiles = core.Dotfiles(**settings)

    dispatch(dotfiles, cli_opts.action, cli_opts.force, args)
예제 #3
0
파일: core.py 프로젝트: ray2804/dotfiles
    def move(self, target):
        """Move the repository to another location."""
        target = realpath_expanduser(target)

        if os.path.exists(target):
            raise ValueError('Target already exists: %s' % (target))

        if not self.dry_run:
            shutil.copytree(self.repository, target, symlinks=True)
            shutil.rmtree(self.repository)
        else:
            print("Recursive copy %s => %s" % (self.repository, target))
            print("Removing %s and everything under it" % self.repository)

        self.repository = target

        if not self.dry_run:
            self._load()
            self.sync(force=True)
예제 #4
0
    def move(self, target):
        """Move the repository to another location."""
        target = realpath_expanduser(target)

        if os.path.exists(target):
            raise ValueError('Target already exists: %s' % (target))

        if not self.dry_run:
            shutil.copytree(self.repository, target, symlinks=True)
            shutil.rmtree(self.repository)
        else:
            print("Recursive copy %s => %s" % (self.repository, target))
            print("Removing %s and everything under it" % self.repository)

        self.repository = target

        if not self.dry_run:
            self._load()
            self.sync(force=True)
예제 #5
0
def compare_path(path1, path2):
    return (realpath_expanduser(path1) == realpath_expanduser(path2))
예제 #6
0
def compare_path(path1, path2):
    return (realpath_expanduser(path1) == realpath_expanduser(path2))