import stat
import subprocess
import sys
-from typing import Generator, List, Optional
+from typing import List, Optional
# logging output stream, setup in main()
log = None
return target
-def checksum(path: Path) -> Generator[Path, None, None]:
- """generate checksum(s) for the given file"""
+def checksum(path: Path) -> Path:
+ """generate checksum for the given file"""
assert path.exists()
with open(check, "wt") as f:
with open(path, "rb") as data:
f.write(f"{hashlib.sha256(data.read()).hexdigest()} {path}\n")
- yield check
+ return check
def is_macos_artifact(path: Path) -> bool:
"""is this a deployment artifact for macOS?"""
log.error(f"source {tarball} not found")
return -1
- # accrue the source tarball and accompanying checksum(s)
+ # accrue the source tarball and accompanying checksum
url = upload(package_version, tarball)
assets.append(url)
webentry = {
"format": get_format(tarball),
"url": url
}
- for check in checksum(tarball):
- url = upload(package_version, check)
- assets.append(url)
- webentry[check.suffix[1:]] = url
+ check = checksum(tarball)
+ url = upload(package_version, check)
+ assets.append(url)
+ webentry[check.suffix[1:]] = url
webdata["sources"].append(webentry)
# if this is a standalone Windows or macOS package, also provide
# checksum(s)
if is_macos_artifact(path) or is_windows_artifact(path):
- for c in checksum(path):
- url = upload(package_version, c, str(c)[len("Packages/"):])
- assets.append(url)
- webentry[c.suffix[1:]] = url
+ c = checksum(path)
+ url = upload(package_version, c, str(c)[len("Packages/"):])
+ assets.append(url)
+ webentry[c.suffix[1:]] = url
# only expose a subset of the Windows artifacts
if "stable_windows_10_cmake_Release_Win32" in str(path) or \