예제 #1
0
파일: reset.py 프로젝트: darkfeline/winenv
def main(args):
    config = configlib.load_config(args.config)
    shell = shells.SHELLS[args.shell]
    print(shell.command_separator.join((
        shell.unset_variable('WINEPREFIX'),
        shell.unset_variable('WINEARCH'),
        shell.export_variable('LANG', config['DEFAULT']['lang']),
    )))
예제 #2
0
파일: load.py 프로젝트: darkfeline/winenv
def main(args):
    config = configlib.load_config(args.config)
    name = args.name
    if not config.has_section(name):
        logger.error("%s environment doesn't exist", name)
        sys.exit(1)
    shell = shells.SHELLS[args.shell]
    print(shell.command_separator.join((
        shell.export_variable(var, value)
        for var, value in load_vars(config[name])
    )))
예제 #3
0
파일: list.py 프로젝트: darkfeline/winenv
def main(args):
    config = configlib.load_config(args.config)
    if args.verbose:
        sections = []
        for section in config.sections():
            lines = []
            lines.append(section)
            for key in _KEYS:
                lines.append('{}={}'.format(key, config[section][key]))
            sections.append('\n'.join(lines))
        print('\n\n'.join(sections))
    else:
        for section in config.sections():
            print(section)
예제 #4
0
파일: add.py 프로젝트: darkfeline/winenv
def main(args):
    config = configlib.load_config(args.config)
    name = args.name
    if name not in config:
        config.add_section(name)
    if args.prefix is None:
        args.prefix = os.path.join(os.environ['HOME'], '.local', 'share',
                                   'wineprefixes', args.name)
    config[name]['prefix'] = args.prefix
    if args.arch is not None:
        config[name]['arch'] = args.arch
    if args.lang is not None:
        config[name]['lang'] = args.lang
    configlib.save_config(config, args.config)