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
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
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
def get_sources(): return [ os.path.normpath(os.path.abspath(r)) for r in get_var('vial_python_sources', [os.getcwd()]) ]
def get_sources(): return [os.path.normpath(os.path.abspath(r)) for r in get_var('vial_python_sources', [os.getcwd()])]
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))