From 6819d4174a4edc62010542815c241ecbfe7ffc35 Mon Sep 17 00:00:00 2001 From: Jussi Kukkonen Date: Thu, 24 Mar 2022 14:37:25 +0200 Subject: [PATCH] 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 --- verify_release | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/verify_release b/verify_release index 4172c2df..1d4176f5 100755 --- a/verify_release +++ b/verify_release @@ -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