Download the sdist source distribution of package ``name`` and ``version`` into the ``dest_dir`` directory. Return a fetched filename or None. Use the first PyPI simple repository from a list of ``repos`` that contains this sdist.
(name, version, dest_dir=THIRDPARTY_DIR, repos=tuple())
| 284 | |
| 285 | |
| 286 | def download_sdist(name, version, dest_dir=THIRDPARTY_DIR, repos=tuple()): |
| 287 | """ |
| 288 | Download the sdist source distribution of package ``name`` and ``version`` |
| 289 | into the ``dest_dir`` directory. Return a fetched filename or None. |
| 290 | |
| 291 | Use the first PyPI simple repository from a list of ``repos`` that contains |
| 292 | this sdist. |
| 293 | """ |
| 294 | if TRACE: |
| 295 | print(f" download_sdist: {name}=={version}") |
| 296 | |
| 297 | if not repos: |
| 298 | repos = DEFAULT_PYPI_REPOS |
| 299 | |
| 300 | fetched_sdist_filename = None |
| 301 | |
| 302 | for repo in repos: |
| 303 | package = repo.get_package_version(name=name, version=version) |
| 304 | |
| 305 | if not package: |
| 306 | if TRACE_DEEP: |
| 307 | print(f" download_sdist: No package in {repo.index_url} for {name}=={version}") |
| 308 | continue |
| 309 | sdist = package.sdist |
| 310 | if not sdist: |
| 311 | if TRACE_DEEP: |
| 312 | print(f" download_sdist: No sdist for {name}=={version}") |
| 313 | continue |
| 314 | |
| 315 | if TRACE_DEEP: |
| 316 | print(f" download_sdist: Getting sdist from index (or cache): {sdist.download_url}") |
| 317 | fetched_sdist_filename = package.sdist.download(dest_dir=dest_dir) |
| 318 | |
| 319 | if fetched_sdist_filename: |
| 320 | # do not futher fetch from other repos if we find in first, typically PyPI |
| 321 | break |
| 322 | |
| 323 | return fetched_sdist_filename |
| 324 | |
| 325 | |
| 326 | ################################################################################ |
nothing calls this directly
no test coverage detected