def install_virtualenv_p2(root, python_version):
    """ Install virtual environment for Python 2.7+; removing the old one if it exists """
    try:
        import virtualenv
    except ImportError:
        sys.stdout.write('Installing virtualenv into global interpreter \n')
        ret_code = subprocess.call([VE_GLOBAL_SCRIPT, PROJECT_ROOT])
        sys.stdout.write('Installation finished with code {0}. Re-run ./launch.py install \n'.format(ret_code))
        sys.exit(ret_code)

    if path.exists(root):
        shutil.rmtree(root)
    virtualenv.logger = virtualenv.Logger(consumers=[])
    virtualenv.create_environment(root, site_packages=False)
    ret_code = subprocess.call([VE_SCRIPT, PROJECT_ROOT, root, python_version])
    sys.exit(ret_code)
def install_virtualenv_p2 ( root , python_version ) : try : import virtualenv except ImportError : sys . stdout . write ( 'Installing virtualenv into global interpreter \n' ) ret_code = subprocess . call ( [ VE_GLOBAL_SCRIPT , PROJECT_ROOT ] ) sys . stdout . write ( 'Installation finished with code {0}. Re-run ./launch.py install \n' . format ( ret_code ) ) sys . exit ( ret_code ) if path . exists ( root ) : shutil . rmtree ( root ) virtualenv . logger = virtualenv . Logger ( consumers = [ ] ) virtualenv . create_environment ( root , site_packages = False ) ret_code = subprocess . call ( [ VE_SCRIPT , PROJECT_ROOT , root , python_version ] ) sys . exit ( ret_code )
Install virtual environment for Python 2.7+; removing the old one if it exists