Download the wheels binary distribution(s) of package ``name`` and ``version`` matching the ``environment`` Environment constraints into the ``dest_dir`` directory. Return a list of fetched_wheel_filenames, possibly empty. Use the first PyPI simple repository from a list of ``r
(name, version, environment, dest_dir=THIRDPARTY_DIR, repos=tuple())
| 238 | |
| 239 | |
| 240 | def download_wheel(name, version, environment, dest_dir=THIRDPARTY_DIR, repos=tuple()): |
| 241 | """ |
| 242 | Download the wheels binary distribution(s) of package ``name`` and |
| 243 | ``version`` matching the ``environment`` Environment constraints into the |
| 244 | ``dest_dir`` directory. Return a list of fetched_wheel_filenames, possibly |
| 245 | empty. |
| 246 | |
| 247 | Use the first PyPI simple repository from a list of ``repos`` that contains this wheel. |
| 248 | """ |
| 249 | if TRACE_DEEP: |
| 250 | print(f" download_wheel: {name}=={version} for envt: {environment}") |
| 251 | |
| 252 | if not repos: |
| 253 | repos = DEFAULT_PYPI_REPOS |
| 254 | |
| 255 | fetched_wheel_filenames = [] |
| 256 | |
| 257 | for repo in repos: |
| 258 | package = repo.get_package_version(name=name, version=version) |
| 259 | if not package: |
| 260 | if TRACE_DEEP: |
| 261 | print(f" download_wheel: No package in {repo.index_url} for {name}=={version}") |
| 262 | continue |
| 263 | supported_wheels = list(package.get_supported_wheels(environment=environment)) |
| 264 | if not supported_wheels: |
| 265 | if TRACE_DEEP: |
| 266 | print( |
| 267 | f" download_wheel: No supported wheel for {name}=={version}: {environment} " |
| 268 | ) |
| 269 | continue |
| 270 | |
| 271 | for wheel in supported_wheels: |
| 272 | if TRACE_DEEP: |
| 273 | print( |
| 274 | f" download_wheel: Getting wheel from index (or cache): {wheel.download_url}" |
| 275 | ) |
| 276 | fetched_wheel_filename = wheel.download(dest_dir=dest_dir) |
| 277 | fetched_wheel_filenames.append(fetched_wheel_filename) |
| 278 | |
| 279 | if fetched_wheel_filenames: |
| 280 | # do not futher fetch from other repos if we find in first, typically PyPI |
| 281 | break |
| 282 | |
| 283 | return fetched_wheel_filenames |
| 284 | |
| 285 | |
| 286 | def download_sdist(name, version, dest_dir=THIRDPARTY_DIR, repos=tuple()): |
nothing calls this directly
no test coverage detected