Skip to content

Commit

Permalink
Fix str2bool failure on stubsabot dry-run (#12287)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Jul 6, 2024
1 parent 99c1b71 commit 7c26da2
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions scripts/stubsabot.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,16 @@ async def release_contains_py_typed(release_to_download: PypiReleaseDownload, *,
with zipfile.ZipFile(body) as zf:
return all_py_files_in_source_are_in_py_typed_dirs(zf)
elif packagetype == "sdist":
assert release_to_download.filename.endswith(
".tar.gz"
), f"Package file {release_to_download.filename!r} does not end with '.tar.gz'"
with tarfile.open(fileobj=body, mode="r:gz") as zf:
return all_py_files_in_source_are_in_py_typed_dirs(zf)
# sdist defaults to `.tar.gz` on Lunix and to `.zip` on Windows:
# https://docs.python.org/3.11/distutils/sourcedist.html
if release_to_download.filename.endswith(".tar.gz"):
with tarfile.open(fileobj=body, mode="r:gz") as zf:
return all_py_files_in_source_are_in_py_typed_dirs(zf)
elif release_to_download.filename.endswith(".zip"):
with zipfile.ZipFile(body) as zf:
return all_py_files_in_source_are_in_py_typed_dirs(zf)
else:
raise AssertionError(f"Package file {release_to_download.filename!r} does not end with '.tar.gz' or '.zip'")
else:
raise AssertionError(f"Unknown package type for {release_to_download.distribution}: {packagetype!r}")

Expand Down

0 comments on commit 7c26da2

Please sign in to comment.