From 32b91edef64d1c726c88c7a7d6e68239399cc358 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Mon, 22 Nov 2021 18:25:51 -0800 Subject: [PATCH] deploy.py: outline functionality for deriving the 'format' field of JSON output This will be used in a future commit to add Windows entries to the JSON data. --- ci/deploy.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/ci/deploy.py b/ci/deploy.py index 8e0d4f500..be6473cd8 100644 --- a/ci/deploy.py +++ b/ci/deploy.py @@ -83,6 +83,14 @@ def is_windows_artifact(path: Path) -> bool: """is this a deployment artifact for Windows?""" return re.search(r"\bwindows\b", str(path)) is not None +def get_format(path: Path) -> str: + """a human readable description of the format of this file""" + if path.suffix[1:].lower() == "exe": + return "EXE installer" + if path.suffix[1:].lower() == "zip": + return "ZIP installer" + return path.suffix[1:].lower() + def main(args: List[str]) -> int: # pylint: disable=missing-function-docstring # setup logging to print to stderr @@ -167,7 +175,7 @@ def main(args: List[str]) -> int: # pylint: disable=missing-function-docstring url = upload(package_version, tarball) assets.append(url) webentry = { - "format": tarball.suffix[1:], + "format": get_format(tarball), "url": url } for check in checksum(tarball): -- 2.40.0