示例#1
0
def get_executable():
    name = get_var('vial_python_executable', 'default')

    try:
        return get_var('vial_python_executables', {})[name]
    except KeyError:
        pass

    path = get_virtualenvwrapper_executable(name)
    if path:
        return path

    if name == 'default':
        if 'VIRTUAL_ENV' in os.environ:
            return which('python')
        else:
            return sys.executable
    elif name == 'python2':
        path = which('python2')
        if path:
            return path
    elif name == 'python3':
        path = which('python3')
        if path:
            return path

    return sys.executable
示例#2
0
def get_executable():
    name = get_var('vial_python_executable', 'default')

    try:
        return get_var('vial_python_executables', {})[name]
    except KeyError:
        pass

    path = get_virtualenvwrapper_executable(name)
    if path:
        return path

    if name == 'default':
        if 'VIRTUAL_ENV' in os.environ:
            return which('python')
        else:
            return which('python3')
    elif name == 'python2':
        path = which('python2')
        if path:
            return path
    elif name == 'python3':
        path = which('python3')
        if path:
            return path

    return sys.executable
示例#3
0
def get():
    executable = get_executable()
    try:
        env = environments[executable]
    except KeyError:
        logfile = join(tempfile.gettempdir(), 'supp.log')
        env = Environment(executable, get_var('vial_python_executable_env',
                                              {}), logfile)
        env.configure({'sources': get_sources()})
        environments[executable] = env

    return env
示例#4
0
def get():
    executable = get_executable()
    try:
        env = environments[executable]
    except KeyError:
        logfile = join(tempfile.gettempdir(), 'supp.log')
        env = Environment(executable,
                          get_var('vial_python_executable_env', {}), logfile)
        env.configure({'sources': get_sources()})
        environments[executable] = env

    return env
示例#5
0
def get_sources():
    return [
        os.path.normpath(os.path.abspath(r))
        for r in get_var('vial_python_sources', [os.getcwd()])
    ]
示例#6
0
def get_sources():
    return [os.path.normpath(os.path.abspath(r))
            for r in get_var('vial_python_sources', [os.getcwd()])]
示例#7
0
def executable_choice(start, cmdline, pos):
    executables = set(('default', 'python2', 'python3'))\
        .union(env.get_virtualenvwrapper_executables())\
        .union(get_var('vial_python_executables', {}))

    return '\n'.join(sorted(executables))
示例#8
0
def executable_choice(start, cmdline, pos):
    executables = set(('default', 'python2', 'python3'))\
        .union(env.get_virtualenvwrapper_executables())\
        .union(get_var('vial_python_executables', {}))

    return '\n'.join(sorted(executables))