verify_release: Be specific about expected artifacts

Use a hard-coded list of artifacts that we expect to find in a
release. Specifically check that each of those files matches
the corresponding file in locally built release.

Also add two missing annotations.

Signed-off-by: Jussi Kukkonen <jkukkonen@vmware.com>
This commit is contained in:
Jussi Kukkonen 2022-03-24 14:37:25 +02:00
parent 65d6503e63
commit 6819d4174a

View file

@ -84,11 +84,15 @@ def verify_github_release(version: str, compare_dir: str) -> bool:
for data in response.iter_content():
f.write(data)
return not dircmp(github_dir, compare_dir).diff_files
same = dircmp(github_dir, compare_dir).same_files
return sorted(same) == [wheel, tar]
def verify_pypi_release(version: str, compare_dir: str) -> bool:
"""Verify that given PyPI version artifacts match expected artifacts"""
tar = f"{PYPI_PROJECT}-{version}.tar.gz"
wheel = f"{PYPI_PROJECT}-{version}-py3-none-any.whl"
with TemporaryDirectory() as pypi_dir:
cmd = ["pip", "download", "--no-deps", "--dest", pypi_dir]
target = f"{PYPI_PROJECT}=={version}"
@ -98,16 +102,17 @@ def verify_pypi_release(version: str, compare_dir: str) -> bool:
subprocess.run(binary_download, stdout=subprocess.DEVNULL, check=True)
subprocess.run(source_download, stdout=subprocess.DEVNULL, check=True)
return not dircmp(pypi_dir, compare_dir).diff_files
same = dircmp(pypi_dir, compare_dir).same_files
return sorted(same) == [wheel, tar]
def finished(s: str):
def finished(s: str) -> None:
# clear line
sys.stdout.write("\033[K")
print(f"* {s}")
def progress(s: str):
def progress(s: str) -> None:
# clear line
sys.stdout.write("\033[K")
# carriage return but no newline: next print will overwrite this one