We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
virtualenv raises StopIteration exception when processing extra search directory wheels.
**Issue**

When creating virtualenv when using `--extra-search-directory`, ``StopIteration`` exception is raised when processing wheels.
**Environment**

Provide at least:
- OS: Centos7
- ``virtualenv`` is installed:
virtualenv version: 20.0.15
```console
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/lib64/python3.6/threading.py", line 916, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.6/threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.6/site-packages/virtualenv/seed/via_app_data/via_app_data.py", line 75, in _get
    self.app_data,
  File "/usr/local/lib/python3.6/site-packages/virtualenv/seed/embed/wheels/acquire.py", line 30, in get_wheels
    acquire_from_dir(processed, for_py_version, wheel_cache_dir, extra_search_dir)
  File "/usr/local/lib/python3.6/site-packages/virtualenv/seed/embed/wheels/acquire.py", line 74, in acquire_from_dir
    if wheel_support_py(filename, for_py_version):
  File "/usr/local/lib/python3.6/site-packages/virtualenv/seed/embed/wheels/acquire.py", line 91, in wheel_support_py
    requires = next(i[len(marker) :] for i in metadata.splitlines() if i.startswith(marker))
StopIteration
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/virtualenv/seed/embed/wheels/acquire.py`
Content:
```
1 """Bootstrap"""
2 from __future__ import absolute_import, unicode_literals
3 
4 import logging
5 import os
6 import sys
7 from collections import defaultdict
8 from contextlib import contextmanager
9 from copy import copy
10 from shutil import copy2
11 from zipfile import ZipFile
12 
13 from virtualenv.info import IS_ZIPAPP
14 from virtualenv.util.path import Path
15 from virtualenv.util.six import ensure_str, ensure_text
16 from virtualenv.util.subprocess import Popen, subprocess
17 from virtualenv.util.zipapp import ensure_file_on_disk
18 
19 from . import BUNDLE_SUPPORT, MAX
20 
21 BUNDLE_FOLDER = Path(os.path.abspath(__file__)).parent
22 
23 
24 def get_wheels(for_py_version, wheel_cache_dir, extra_search_dir, download, packages, app_data):
25     # not all wheels are compatible with all python versions, so we need to py version qualify it
26     processed = copy(packages)
27     # 1. acquire from bundle
28     acquire_from_bundle(processed, for_py_version, wheel_cache_dir)
29     # 2. acquire from extra search dir
30     acquire_from_dir(processed, for_py_version, wheel_cache_dir, extra_search_dir)
31     # 3. download from the internet
32     if download and processed:
33         download_wheel(processed, for_py_version, wheel_cache_dir, app_data)
34 
35     # in the end just get the wheels
36     wheels = _get_wheels(wheel_cache_dir, packages)
37     return {p: next(iter(ver_to_files))[1] for p, ver_to_files in wheels.items()}
38 
39 
40 def acquire_from_bundle(packages, for_py_version, to_folder):
41     for pkg, version in list(packages.items()):
42         bundle = get_bundled_wheel(pkg, for_py_version)
43         if bundle is not None:
44             pkg_version = bundle.stem.split("-")[1]
45             exact_version_match = version == pkg_version
46             if exact_version_match:
47                 del packages[pkg]
48             if version is None or exact_version_match:
49                 bundled_wheel_file = to_folder / bundle.name
50                 if not bundled_wheel_file.exists():
51                     logging.debug("get bundled wheel %s", bundle)
52                     if IS_ZIPAPP:
53                         from virtualenv.util.zipapp import extract
54 
55                         extract(bundle, bundled_wheel_file)
56                     else:
57                         copy2(str(bundle), str(bundled_wheel_file))
58 
59 
60 def get_bundled_wheel(package, version_release):
61     return BUNDLE_FOLDER / (BUNDLE_SUPPORT.get(version_release, {}) or BUNDLE_SUPPORT[MAX]).get(package)
62 
63 
64 def acquire_from_dir(packages, for_py_version, to_folder, extra_search_dir):
65     if not packages:
66         return
67     for search_dir in extra_search_dir:
68         wheels = _get_wheels(search_dir, packages)
69         for pkg, ver_wheels in wheels.items():
70             stop = False
71             for _, filename in ver_wheels:
72                 dest = to_folder / filename.name
73                 if not dest.exists():
74                     if wheel_support_py(filename, for_py_version):
75                         logging.debug("get extra search dir wheel %s", filename)
76                         copy2(str(filename), str(dest))
77                         stop = True
78                 else:
79                     stop = True
80                 if stop and packages[pkg] is not None:
81                     del packages[pkg]
82                     break
83 
84 
85 def wheel_support_py(filename, py_version):
86     name = "{}.dist-info/METADATA".format("-".join(filename.stem.split("-")[0:2]))
87     with ZipFile(ensure_text(str(filename)), "r") as zip_file:
88         metadata = zip_file.read(name).decode("utf-8")
89     marker = "Requires-Python:"
90     requires = next(i[len(marker) :] for i in metadata.splitlines() if i.startswith(marker))
91     py_version_int = tuple(int(i) for i in py_version.split("."))
92     for require in (i.strip() for i in requires.split(",")):
93         # https://www.python.org/dev/peps/pep-0345/#version-specifiers
94         for operator, check in [
95             ("!=", lambda v: py_version_int != v),
96             ("==", lambda v: py_version_int == v),
97             ("<=", lambda v: py_version_int <= v),
98             (">=", lambda v: py_version_int >= v),
99             ("<", lambda v: py_version_int < v),
100             (">", lambda v: py_version_int > v),
101         ]:
102             if require.startswith(operator):
103                 ver_str = require[len(operator) :].strip()
104                 version = tuple((int(i) if i != "*" else None) for i in ver_str.split("."))[0:2]
105                 if not check(version):
106                     return False
107                 break
108     return True
109 
110 
111 def _get_wheels(from_folder, packages):
112     wheels = defaultdict(list)
113     for filename in from_folder.iterdir():
114         if filename.suffix == ".whl":
115             data = filename.stem.split("-")
116             if len(data) >= 2:
117                 pkg, version = data[0:2]
118                 if pkg in packages:
119                     pkg_version = packages[pkg]
120                     if pkg_version is None or pkg_version == version:
121                         wheels[pkg].append((version, filename))
122     for versions in wheels.values():
123         versions.sort(
124             key=lambda a: tuple(int(i) if i.isdigit() else i for i in a[0].split(".")), reverse=True,
125         )
126     return wheels
127 
128 
129 def download_wheel(packages, for_py_version, to_folder, app_data):
130     to_download = list(p if v is None else "{}={}".format(p, v) for p, v in packages.items())
131     logging.debug("download wheels %s", to_download)
132     cmd = [
133         sys.executable,
134         "-m",
135         "pip",
136         "download",
137         "--disable-pip-version-check",
138         "--only-binary=:all:",
139         "--no-deps",
140         "--python-version",
141         for_py_version,
142         "-d",
143         str(to_folder),
144     ]
145     cmd.extend(to_download)
146     # pip has no interface in python - must be a new sub-process
147 
148     with pip_wheel_env_run("{}{}".format(*sys.version_info[0:2]), app_data) as env:
149         process = Popen(cmd, env=env, stdout=subprocess.PIPE)
150         process.communicate()
151         if process.returncode != 0:
152             raise RuntimeError("failed to download wheels")
153 
154 
155 @contextmanager
156 def pip_wheel_env_run(version, app_data):
157     env = os.environ.copy()
158     env.update(
159         {
160             ensure_str(k): str(v)  # python 2 requires these to be string only (non-unicode)
161             for k, v in {"PIP_USE_WHEEL": "1", "PIP_USER": "0", "PIP_NO_INPUT": "1"}.items()
162         }
163     )
164     with ensure_file_on_disk(get_bundled_wheel("pip", version), app_data) as pip_wheel_path:
165         # put the bundled wheel onto the path, and use it to do the bootstrap operation
166         env[str("PYTHONPATH")] = str(pip_wheel_path)
167         yield env
168
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/virtualenv/seed/embed/wheels/acquire.py b/src/virtualenv/seed/embed/wheels/acquire.py
--- a/src/virtualenv/seed/embed/wheels/acquire.py
+++ b/src/virtualenv/seed/embed/wheels/acquire.py
@@ -87,7 +87,9 @@
     with ZipFile(ensure_text(str(filename)), "r") as zip_file:
         metadata = zip_file.read(name).decode("utf-8")
     marker = "Requires-Python:"
-    requires = next(i[len(marker) :] for i in metadata.splitlines() if i.startswith(marker))
+    requires = next((i[len(marker) :] for i in metadata.splitlines() if i.startswith(marker)), None)
+    if requires is None:  # if it does not specify a python requires the assumption is compatible
+        return True
     py_version_int = tuple(int(i) for i in py_version.split("."))
     for require in (i.strip() for i in requires.split(",")):
         # https://www.python.org/dev/peps/pep-0345/#version-specifiers

{"golden_diff": "diff --git a/src/virtualenv/seed/embed/wheels/acquire.py b/src/virtualenv/seed/embed/wheels/acquire.py\n--- a/src/virtualenv/seed/embed/wheels/acquire.py\n+++ b/src/virtualenv/seed/embed/wheels/acquire.py\n@@ -87,7 +87,9 @@\n     with ZipFile(ensure_text(str(filename)), \"r\") as zip_file:\n         metadata = zip_file.read(name).decode(\"utf-8\")\n     marker = \"Requires-Python:\"\n-    requires = next(i[len(marker) :] for i in metadata.splitlines() if i.startswith(marker))\n+    requires = next((i[len(marker) :] for i in metadata.splitlines() if i.startswith(marker)), None)\n+    if requires is None:  # if it does not specify a python requires the assumption is compatible\n+        return True\n     py_version_int = tuple(int(i) for i in py_version.split(\".\"))\n     for require in (i.strip() for i in requires.split(\",\")):\n         # https://www.python.org/dev/peps/pep-0345/#version-specifiers\n", "issue": "virtualenv raises StopIteration exception when processing extra search directory wheels.\n**Issue**\r\n\r\nWhen creating virtualenv when using `--extra-search-directory`, ``StopIteration`` exception is raised when processing wheels.\r\n**Environment**\r\n\r\nProvide at least:\r\n- OS: Centos7\r\n- ``virtualenv`` is installed:\r\nvirtualenv version: 20.0.15\r\n```console\r\nException in thread Thread-3:\r\nTraceback (most recent call last):\r\n  File \"/usr/lib64/python3.6/threading.py\", line 916, in _bootstrap_inner\r\n    self.run()\r\n  File \"/usr/lib64/python3.6/threading.py\", line 864, in run\r\n    self._target(*self._args, **self._kwargs)\r\n  File \"/usr/local/lib/python3.6/site-packages/virtualenv/seed/via_app_data/via_app_data.py\", line 75, in _get\r\n    self.app_data,\r\n  File \"/usr/local/lib/python3.6/site-packages/virtualenv/seed/embed/wheels/acquire.py\", line 30, in get_wheels\r\n    acquire_from_dir(processed, for_py_version, wheel_cache_dir, extra_search_dir)\r\n  File \"/usr/local/lib/python3.6/site-packages/virtualenv/seed/embed/wheels/acquire.py\", line 74, in acquire_from_dir\r\n    if wheel_support_py(filename, for_py_version):\r\n  File \"/usr/local/lib/python3.6/site-packages/virtualenv/seed/embed/wheels/acquire.py\", line 91, in wheel_support_py\r\n    requires = next(i[len(marker) :] for i in metadata.splitlines() if i.startswith(marker))\r\nStopIteration\r\n```\r\n\n", "before_files": [{"content": "\"\"\"Bootstrap\"\"\"\nfrom __future__ import absolute_import, unicode_literals\n\nimport logging\nimport os\nimport sys\nfrom collections import defaultdict\nfrom contextlib import contextmanager\nfrom copy import copy\nfrom shutil import copy2\nfrom zipfile import ZipFile\n\nfrom virtualenv.info import IS_ZIPAPP\nfrom virtualenv.util.path import Path\nfrom virtualenv.util.six import ensure_str, ensure_text\nfrom virtualenv.util.subprocess import Popen, subprocess\nfrom virtualenv.util.zipapp import ensure_file_on_disk\n\nfrom . import BUNDLE_SUPPORT, MAX\n\nBUNDLE_FOLDER = Path(os.path.abspath(__file__)).parent\n\n\ndef get_wheels(for_py_version, wheel_cache_dir, extra_search_dir, download, packages, app_data):\n    # not all wheels are compatible with all python versions, so we need to py version qualify it\n    processed = copy(packages)\n    # 1. acquire from bundle\n    acquire_from_bundle(processed, for_py_version, wheel_cache_dir)\n    # 2. acquire from extra search dir\n    acquire_from_dir(processed, for_py_version, wheel_cache_dir, extra_search_dir)\n    # 3. download from the internet\n    if download and processed:\n        download_wheel(processed, for_py_version, wheel_cache_dir, app_data)\n\n    # in the end just get the wheels\n    wheels = _get_wheels(wheel_cache_dir, packages)\n    return {p: next(iter(ver_to_files))[1] for p, ver_to_files in wheels.items()}\n\n\ndef acquire_from_bundle(packages, for_py_version, to_folder):\n    for pkg, version in list(packages.items()):\n        bundle = get_bundled_wheel(pkg, for_py_version)\n        if bundle is not None:\n            pkg_version = bundle.stem.split(\"-\")[1]\n            exact_version_match = version == pkg_version\n            if exact_version_match:\n                del packages[pkg]\n            if version is None or exact_version_match:\n                bundled_wheel_file = to_folder / bundle.name\n                if not bundled_wheel_file.exists():\n                    logging.debug(\"get bundled wheel %s\", bundle)\n                    if IS_ZIPAPP:\n                        from virtualenv.util.zipapp import extract\n\n                        extract(bundle, bundled_wheel_file)\n                    else:\n                        copy2(str(bundle), str(bundled_wheel_file))\n\n\ndef get_bundled_wheel(package, version_release):\n    return BUNDLE_FOLDER / (BUNDLE_SUPPORT.get(version_release, {}) or BUNDLE_SUPPORT[MAX]).get(package)\n\n\ndef acquire_from_dir(packages, for_py_version, to_folder, extra_search_dir):\n    if not packages:\n        return\n    for search_dir in extra_search_dir:\n        wheels = _get_wheels(search_dir, packages)\n        for pkg, ver_wheels in wheels.items():\n            stop = False\n            for _, filename in ver_wheels:\n                dest = to_folder / filename.name\n                if not dest.exists():\n                    if wheel_support_py(filename, for_py_version):\n                        logging.debug(\"get extra search dir wheel %s\", filename)\n                        copy2(str(filename), str(dest))\n                        stop = True\n                else:\n                    stop = True\n                if stop and packages[pkg] is not None:\n                    del packages[pkg]\n                    break\n\n\ndef wheel_support_py(filename, py_version):\n    name = \"{}.dist-info/METADATA\".format(\"-\".join(filename.stem.split(\"-\")[0:2]))\n    with ZipFile(ensure_text(str(filename)), \"r\") as zip_file:\n        metadata = zip_file.read(name).decode(\"utf-8\")\n    marker = \"Requires-Python:\"\n    requires = next(i[len(marker) :] for i in metadata.splitlines() if i.startswith(marker))\n    py_version_int = tuple(int(i) for i in py_version.split(\".\"))\n    for require in (i.strip() for i in requires.split(\",\")):\n        # https://www.python.org/dev/peps/pep-0345/#version-specifiers\n        for operator, check in [\n            (\"!=\", lambda v: py_version_int != v),\n            (\"==\", lambda v: py_version_int == v),\n            (\"<=\", lambda v: py_version_int <= v),\n            (\">=\", lambda v: py_version_int >= v),\n            (\"<\", lambda v: py_version_int < v),\n            (\">\", lambda v: py_version_int > v),\n        ]:\n            if require.startswith(operator):\n                ver_str = require[len(operator) :].strip()\n                version = tuple((int(i) if i != \"*\" else None) for i in ver_str.split(\".\"))[0:2]\n                if not check(version):\n                    return False\n                break\n    return True\n\n\ndef _get_wheels(from_folder, packages):\n    wheels = defaultdict(list)\n    for filename in from_folder.iterdir():\n        if filename.suffix == \".whl\":\n            data = filename.stem.split(\"-\")\n            if len(data) >= 2:\n                pkg, version = data[0:2]\n                if pkg in packages:\n                    pkg_version = packages[pkg]\n                    if pkg_version is None or pkg_version == version:\n                        wheels[pkg].append((version, filename))\n    for versions in wheels.values():\n        versions.sort(\n            key=lambda a: tuple(int(i) if i.isdigit() else i for i in a[0].split(\".\")), reverse=True,\n        )\n    return wheels\n\n\ndef download_wheel(packages, for_py_version, to_folder, app_data):\n    to_download = list(p if v is None else \"{}={}\".format(p, v) for p, v in packages.items())\n    logging.debug(\"download wheels %s\", to_download)\n    cmd = [\n        sys.executable,\n        \"-m\",\n        \"pip\",\n        \"download\",\n        \"--disable-pip-version-check\",\n        \"--only-binary=:all:\",\n        \"--no-deps\",\n        \"--python-version\",\n        for_py_version,\n        \"-d\",\n        str(to_folder),\n    ]\n    cmd.extend(to_download)\n    # pip has no interface in python - must be a new sub-process\n\n    with pip_wheel_env_run(\"{}{}\".format(*sys.version_info[0:2]), app_data) as env:\n        process = Popen(cmd, env=env, stdout=subprocess.PIPE)\n        process.communicate()\n        if process.returncode != 0:\n            raise RuntimeError(\"failed to download wheels\")\n\n\n@contextmanager\ndef pip_wheel_env_run(version, app_data):\n    env = os.environ.copy()\n    env.update(\n        {\n            ensure_str(k): str(v)  # python 2 requires these to be string only (non-unicode)\n            for k, v in {\"PIP_USE_WHEEL\": \"1\", \"PIP_USER\": \"0\", \"PIP_NO_INPUT\": \"1\"}.items()\n        }\n    )\n    with ensure_file_on_disk(get_bundled_wheel(\"pip\", version), app_data) as pip_wheel_path:\n        # put the bundled wheel onto the path, and use it to do the bootstrap operation\n        env[str(\"PYTHONPATH\")] = str(pip_wheel_path)\n        yield env\n", "path": "src/virtualenv/seed/embed/wheels/acquire.py"}], "after_files": [{"content": "\"\"\"Bootstrap\"\"\"\nfrom __future__ import absolute_import, unicode_literals\n\nimport logging\nimport os\nimport sys\nfrom collections import defaultdict\nfrom contextlib import contextmanager\nfrom copy import copy\nfrom shutil import copy2\nfrom zipfile import ZipFile\n\nfrom virtualenv.info import IS_ZIPAPP\nfrom virtualenv.util.path import Path\nfrom virtualenv.util.six import ensure_str, ensure_text\nfrom virtualenv.util.subprocess import Popen, subprocess\nfrom virtualenv.util.zipapp import ensure_file_on_disk\n\nfrom . import BUNDLE_SUPPORT, MAX\n\nBUNDLE_FOLDER = Path(os.path.abspath(__file__)).parent\n\n\ndef get_wheels(for_py_version, wheel_cache_dir, extra_search_dir, download, packages, app_data):\n    # not all wheels are compatible with all python versions, so we need to py version qualify it\n    processed = copy(packages)\n    # 1. acquire from bundle\n    acquire_from_bundle(processed, for_py_version, wheel_cache_dir)\n    # 2. acquire from extra search dir\n    acquire_from_dir(processed, for_py_version, wheel_cache_dir, extra_search_dir)\n    # 3. download from the internet\n    if download and processed:\n        download_wheel(processed, for_py_version, wheel_cache_dir, app_data)\n\n    # in the end just get the wheels\n    wheels = _get_wheels(wheel_cache_dir, packages)\n    return {p: next(iter(ver_to_files))[1] for p, ver_to_files in wheels.items()}\n\n\ndef acquire_from_bundle(packages, for_py_version, to_folder):\n    for pkg, version in list(packages.items()):\n        bundle = get_bundled_wheel(pkg, for_py_version)\n        if bundle is not None:\n            pkg_version = bundle.stem.split(\"-\")[1]\n            exact_version_match = version == pkg_version\n            if exact_version_match:\n                del packages[pkg]\n            if version is None or exact_version_match:\n                bundled_wheel_file = to_folder / bundle.name\n                if not bundled_wheel_file.exists():\n                    logging.debug(\"get bundled wheel %s\", bundle)\n                    if IS_ZIPAPP:\n                        from virtualenv.util.zipapp import extract\n\n                        extract(bundle, bundled_wheel_file)\n                    else:\n                        copy2(str(bundle), str(bundled_wheel_file))\n\n\ndef get_bundled_wheel(package, version_release):\n    return BUNDLE_FOLDER / (BUNDLE_SUPPORT.get(version_release, {}) or BUNDLE_SUPPORT[MAX]).get(package)\n\n\ndef acquire_from_dir(packages, for_py_version, to_folder, extra_search_dir):\n    if not packages:\n        return\n    for search_dir in extra_search_dir:\n        wheels = _get_wheels(search_dir, packages)\n        for pkg, ver_wheels in wheels.items():\n            stop = False\n            for _, filename in ver_wheels:\n                dest = to_folder / filename.name\n                if not dest.exists():\n                    if wheel_support_py(filename, for_py_version):\n                        logging.debug(\"get extra search dir wheel %s\", filename)\n                        copy2(str(filename), str(dest))\n                        stop = True\n                else:\n                    stop = True\n                if stop and packages[pkg] is not None:\n                    del packages[pkg]\n                    break\n\n\ndef wheel_support_py(filename, py_version):\n    name = \"{}.dist-info/METADATA\".format(\"-\".join(filename.stem.split(\"-\")[0:2]))\n    with ZipFile(ensure_text(str(filename)), \"r\") as zip_file:\n        metadata = zip_file.read(name).decode(\"utf-8\")\n    marker = \"Requires-Python:\"\n    requires = next((i[len(marker) :] for i in metadata.splitlines() if i.startswith(marker)), None)\n    if requires is None:  # if it does not specify a python requires the assumption is compatible\n        return True\n    py_version_int = tuple(int(i) for i in py_version.split(\".\"))\n    for require in (i.strip() for i in requires.split(\",\")):\n        # https://www.python.org/dev/peps/pep-0345/#version-specifiers\n        for operator, check in [\n            (\"!=\", lambda v: py_version_int != v),\n            (\"==\", lambda v: py_version_int == v),\n            (\"<=\", lambda v: py_version_int <= v),\n            (\">=\", lambda v: py_version_int >= v),\n            (\"<\", lambda v: py_version_int < v),\n            (\">\", lambda v: py_version_int > v),\n        ]:\n            if require.startswith(operator):\n                ver_str = require[len(operator) :].strip()\n                version = tuple((int(i) if i != \"*\" else None) for i in ver_str.split(\".\"))[0:2]\n                if not check(version):\n                    return False\n                break\n    return True\n\n\ndef _get_wheels(from_folder, packages):\n    wheels = defaultdict(list)\n    for filename in from_folder.iterdir():\n        if filename.suffix == \".whl\":\n            data = filename.stem.split(\"-\")\n            if len(data) >= 2:\n                pkg, version = data[0:2]\n                if pkg in packages:\n                    pkg_version = packages[pkg]\n                    if pkg_version is None or pkg_version == version:\n                        wheels[pkg].append((version, filename))\n    for versions in wheels.values():\n        versions.sort(\n            key=lambda a: tuple(int(i) if i.isdigit() else i for i in a[0].split(\".\")), reverse=True,\n        )\n    return wheels\n\n\ndef download_wheel(packages, for_py_version, to_folder, app_data):\n    to_download = list(p if v is None else \"{}={}\".format(p, v) for p, v in packages.items())\n    logging.debug(\"download wheels %s\", to_download)\n    cmd = [\n        sys.executable,\n        \"-m\",\n        \"pip\",\n        \"download\",\n        \"--disable-pip-version-check\",\n        \"--only-binary=:all:\",\n        \"--no-deps\",\n        \"--python-version\",\n        for_py_version,\n        \"-d\",\n        str(to_folder),\n    ]\n    cmd.extend(to_download)\n    # pip has no interface in python - must be a new sub-process\n\n    with pip_wheel_env_run(\"{}{}\".format(*sys.version_info[0:2]), app_data) as env:\n        process = Popen(cmd, env=env, stdout=subprocess.PIPE)\n        process.communicate()\n        if process.returncode != 0:\n            raise RuntimeError(\"failed to download wheels\")\n\n\n@contextmanager\ndef pip_wheel_env_run(version, app_data):\n    env = os.environ.copy()\n    env.update(\n        {\n            ensure_str(k): str(v)  # python 2 requires these to be string only (non-unicode)\n            for k, v in {\"PIP_USE_WHEEL\": \"1\", \"PIP_USER\": \"0\", \"PIP_NO_INPUT\": \"1\"}.items()\n        }\n    )\n    with ensure_file_on_disk(get_bundled_wheel(\"pip\", version), app_data) as pip_wheel_path:\n        # put the bundled wheel onto the path, and use it to do the bootstrap operation\n        env[str(\"PYTHONPATH\")] = str(pip_wheel_path)\n        yield env\n", "path": "src/virtualenv/seed/embed/wheels/acquire.py"}]}