Пример #1
0
def switch_python():
    """Magically switch to macports python"""
    env = os.environ.copy()
    env['PATH'] = [os.path.join(macports_prefix(), 'bin'),
                   os.path.join(macports_prefix(), 'sbin'),] + [env.get('PATH', '')]
    env['PATH'] = ':'.join(env['PATH'])
    sys.stdout.write('Switching to MacPorts Python ')
    if options.VERBOSE:
        sys.stdout.write(python_executable() + ' ' + ' '.join(sys.argv))
    sys.stdout.write('\n\n')
    sys.stdout.flush()
    os.execve(python_executable(), [python_executable()] + sys.argv, env)
Пример #2
0
def python_sys_executables():
    exes = glob.glob(os.path.join(macports_prefix(), 'bin', 'python*'))
    full_paths = []
    for exe in exes:
        full_paths.append(os.path.realpath(exe))
    return full_paths
Пример #3
0
def python_executable():
    return os.path.join(macports_prefix(), 'bin', 'python')