if m is not None: dist_url = m.groups()[0] if dist_url is None: raise RuntimeError('virtualenv dist not found') # Fetch virtualenv from PyPI with closing(urlopen(dist_url.decode(), context=ctx)) as resp: if resp.getcode() != 200: raise RuntimeError('Wrong response receive from PyPI') data = resp.read() # Untar data = StringIO(data) with removable_tempdir() as temp_dir: with closing(tarfile.open(fileobj=data)) as data: data.extractall(temp_dir) venv_py = glob.glob(os.path.join(temp_dir, '*', 'virtualenv.py')) if not venv_py: venv_py = glob.glob(os.path.join(temp_dir, '*', '*', 'virtualenv.py')) venv_py = venv_py[0] # Create the initial env subprocess.check_call((sys.executable, venv_py, INITIAL_ENV)) # Second stage if len(sys.argv) > 1: bin_folder = 'bin' if sys.platform != 'win32' else 'Scripts' venv_python = os.path.join(INITIAL_ENV, bin_folder, 'python') subprocess.check_call([ venv_python,